FrmMonthSalesStatistics.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmMonthSalesStatistics">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="月度销售统计";
  9. GetSchema();
  10. txtCoNo.CValue=GetCurrentCompanyNo();
  11. txtCoName.CValue=GetCurrentCompanyShortName();
  12. ChangeMode("Search");
  13. ]]>
  14. </Load>
  15. <Closing>
  16. ;
  17. </Closing>
  18. <Closed>
  19. ;
  20. </Closed>
  21. </Events>
  22. <Mode>
  23. <Search>
  24. <Lable name="Search"/>
  25. </Search>
  26. </Mode>
  27. <Controls>
  28. <IKDateTimePicker name="dtpDate" DataSource="UI.dtStart"/>
  29. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  30. <Events>
  31. <Click>
  32. <![CDATA[
  33. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  34. if( @temp == "" )
  35. return;
  36. tbCustomerNo1.CValue = @temp;
  37. ]]>
  38. </Click>
  39. <TextBoxButtonTextChanged>
  40. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  41. </TextBoxButtonTextChanged>
  42. </Events>
  43. </IKTextButton>
  44. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  45. <Events>
  46. <Click>
  47. <![CDATA[
  48. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  49. if( @temp == "" )
  50. return;
  51. tbCustomerNo2.CValue = @temp;
  52. ]]>
  53. </Click>
  54. </Events>
  55. </IKTextButton>
  56. <IKComboBoxEx name="cbZone1" DisplaySource="UI.StartZone" DataSource="ZoneType" DisplayMember="Name_TypeDef">
  57. <Events>
  58. <Reload>
  59. UpdateForm(false, "cbZone1");
  60. Search("SearchZoneType");
  61. UpdateForm(true, "cbZone1");
  62. </Reload>
  63. <TextChanged>
  64. cbZone2.Text=cbZone1.Text;
  65. </TextChanged>
  66. </Events>
  67. </IKComboBoxEx>
  68. <IKComboBoxEx name="cbZone2" DisplaySource="UI.EndZone" DataSource="ZoneType" DisplayMember="Name_TypeDef">
  69. <Events>
  70. <Reload>
  71. UpdateForm(false, "cbZone2");
  72. Search("SearchZoneType");
  73. UpdateForm(true, "cbZone2");
  74. </Reload>
  75. </Events>
  76. </IKComboBoxEx>
  77. <IKComboBoxEx name="cbPrincipal1" DisplaySource="UI.StartPrincipal_SaleBill" NoSource="UI.StartNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  78. <Events>
  79. <Reload>
  80. UpdateForm(false, "cbPrincipal1");
  81. Search("SearchPrincipal");
  82. UpdateForm(true, "cbPrincipal1");
  83. </Reload>
  84. </Events>
  85. </IKComboBoxEx>
  86. <IKComboBoxEx name="cbPrincipal2" DisplaySource="UI.EndPrincipal_SaleBill" NoSource="UI.EndNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  87. <Events>
  88. <Reload>
  89. UpdateForm(false, "cbPrincipal2");
  90. Search("SearchPrincipal");
  91. UpdateForm(true, "cbPrincipal2");
  92. </Reload>
  93. </Events>
  94. </IKComboBoxEx>
  95. <IKButton name="btnView">
  96. <Events>
  97. <Click>
  98. @ClickType="View";
  99. <Lable name="Action"/>
  100. </Click>
  101. </Events>
  102. </IKButton>
  103. <IKButton name="btnExcel">
  104. <Events>
  105. <Click>
  106. @ClickType="Excel";
  107. <Lable name="Action"/>
  108. </Click>
  109. </Events>
  110. </IKButton>
  111. <IKButton name="btnWord">
  112. <Events>
  113. <Click>
  114. @ClickType="Word";
  115. <Lable name="Action"/>
  116. </Click>
  117. </Events>
  118. </IKButton>
  119. <IKButton name="btnPrint">
  120. <Events>
  121. <Click>
  122. @ClickType="PrintToPrinter";
  123. <Lable name="Action"/>
  124. </Click>
  125. </Events>
  126. </IKButton>
  127. </Controls>
  128. <ChildForms>
  129. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  130. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  131. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  132. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  133. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  134. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  135. </ChildForm>
  136. </ChildForms>
  137. <FormatString>
  138. <Format name="SearchCustomerCondition">
  139. if(GetRight("客户基本资料","全权查看"))
  140. {
  141. FormatString("");
  142. }
  143. else
  144. {
  145. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  146. }
  147. </Format>
  148. </FormatString>
  149. </Client>
  150. <Server>
  151. <Tables>
  152. <Table name="UI" Type="Parent">
  153. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 convert(datetime,0) as dtStart,convert(nvarchar(64),'') As StartNo_Customer,convert(nvarchar(64),'') As EndNo_Customer,convert(nvarchar(64),'') As StartZone,convert(nvarchar(64),'') As EndZone,
  154. convert(nvarchar(64),'') As StartNo_Principal,convert(nvarchar(64),'') As EndNo_Principal,convert(nvarchar(64),'') As StartPrincipal_SaleBill,convert(nvarchar(64),'') As EndPrincipal_SaleBill"/>
  155. </Table>
  156. </Tables>
  157. <Search>
  158. <SearchMonthStatistics CmdType="Text" CmdText="
  159. Select No_Customer,ShortName_Customer,Type_Customer,BeginDate_Customer,Zone_Customer
  160. ,(IsNull(s1.SumGoodsAmount_SaleBill,0)-IsNull(st1.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount1
  161. ,(IsNull(s2.SumGoodsAmount_SaleBill,0)-IsNull(st2.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount2
  162. ,(IsNull(s3.SumGoodsAmount_SaleBill,0)-IsNull(st3.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount3
  163. ,(IsNull(s4.SumGoodsAmount_SaleBill,0)-IsNull(st4.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount4
  164. ,(IsNull(s5.SumGoodsAmount_SaleBill,0)-IsNull(st5.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount5
  165. ,(IsNull(s6.SumGoodsAmount_SaleBill,0)-IsNull(st6.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount6
  166. ,(IsNull(s7.SumGoodsAmount_SaleBill,0)-IsNull(st7.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount7
  167. ,(IsNull(s8.SumGoodsAmount_SaleBill,0)-IsNull(st8.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount8
  168. ,(IsNull(s9.SumGoodsAmount_SaleBill,0)-IsNull(st9.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount9
  169. ,(IsNull(s10.SumGoodsAmount_SaleBill,0)-IsNull(st10.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount10
  170. ,(IsNull(s11.SumGoodsAmount_SaleBill,0)-IsNull(st11.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount11
  171. ,(IsNull(s12.SumGoodsAmount_SaleBill,0)-IsNull(st12.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount12
  172. From
  173. Customer
  174. Left Join
  175. (
  176. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  177. From SaleBill
  178. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  179. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,@dtStart)&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,1,@dtStart))&gt;0
  180. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  181. Group By ID_Customer
  182. )s1 On Customer.ID_Customer=s1.ID_Customer
  183. Left Join
  184. (
  185. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  186. From SaleRtnBill
  187. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  188. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,@dtStart)&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,1,@dtStart))&gt;0 And @bSaleRtn=1
  189. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  190. Group By ID_Customer
  191. )st1 On Customer.ID_Customer=st1.ID_Customer
  192. Left Join
  193. (
  194. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  195. From SaleBill
  196. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  197. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,1,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,2,@dtStart))&gt;0
  198. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  199. Group By ID_Customer
  200. )s2 On Customer.ID_Customer=s2.ID_Customer
  201. Left Join
  202. (
  203. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  204. From SaleRtnBill
  205. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  206. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,1,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,2,@dtStart))&gt;0 And @bSaleRtn=1
  207. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  208. Group By ID_Customer
  209. )st2 On Customer.ID_Customer=st2.ID_Customer
  210. Left Join
  211. (
  212. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  213. From SaleBill
  214. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  215. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,2,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,3,@dtStart))&gt;0
  216. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  217. Group By ID_Customer
  218. )s3 On Customer.ID_Customer=s3.ID_Customer
  219. Left Join
  220. (
  221. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  222. From SaleRtnBill
  223. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  224. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,2,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,3,@dtStart))&gt;0 And @bSaleRtn=1
  225. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  226. Group By ID_Customer
  227. )st3 On Customer.ID_Customer=st3.ID_Customer
  228. Left Join
  229. (
  230. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  231. From SaleBill
  232. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  233. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,3,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,4,@dtStart))&gt;0
  234. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  235. Group By ID_Customer
  236. )s4 On Customer.ID_Customer=s4.ID_Customer
  237. Left Join
  238. (
  239. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  240. From SaleRtnBill
  241. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  242. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,3,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,4,@dtStart))&gt;0 And @bSaleRtn=1
  243. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  244. Group By ID_Customer
  245. )st4 On Customer.ID_Customer=st4.ID_Customer
  246. Left Join
  247. (
  248. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  249. From SaleBill
  250. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  251. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,4,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,5,@dtStart))&gt;0
  252. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  253. Group By ID_Customer
  254. )s5 On Customer.ID_Customer=s5.ID_Customer
  255. Left Join
  256. (
  257. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  258. From SaleRtnBill
  259. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  260. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,4,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,5,@dtStart))&gt;0 And @bSaleRtn=1
  261. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  262. Group By ID_Customer
  263. )st5 On Customer.ID_Customer=st5.ID_Customer
  264. Left Join
  265. (
  266. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  267. From SaleBill
  268. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  269. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,5,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,6,@dtStart))&gt;0
  270. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  271. Group By ID_Customer
  272. )s6 On Customer.ID_Customer=s6.ID_Customer
  273. Left Join
  274. (
  275. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  276. From SaleRtnBill
  277. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  278. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,5,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,6,@dtStart))&gt;0 And @bSaleRtn=1
  279. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  280. Group By ID_Customer
  281. )st6 On Customer.ID_Customer=st6.ID_Customer
  282. Left Join
  283. (
  284. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  285. From SaleBill
  286. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  287. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,6,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,7,@dtStart))&gt;0
  288. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  289. Group By ID_Customer
  290. )s7 On Customer.ID_Customer=s7.ID_Customer
  291. Left Join
  292. (
  293. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  294. From SaleRtnBill
  295. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  296. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,6,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,7,@dtStart))&gt;0 And @bSaleRtn=1
  297. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  298. Group By ID_Customer
  299. )st7 On Customer.ID_Customer=st7.ID_Customer
  300. Left Join
  301. (
  302. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  303. From SaleBill
  304. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  305. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,7,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,8,@dtStart))&gt;0
  306. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  307. Group By ID_Customer
  308. )s8 On Customer.ID_Customer=s8.ID_Customer
  309. Left Join
  310. (
  311. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  312. From SaleRtnBill
  313. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  314. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,7,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,8,@dtStart))&gt;0 And @bSaleRtn=1
  315. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  316. Group By ID_Customer
  317. )st8 On Customer.ID_Customer=st8.ID_Customer
  318. Left Join
  319. (
  320. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  321. From SaleBill
  322. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  323. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,8,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,9,@dtStart))&gt;0
  324. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  325. Group By ID_Customer
  326. )s9 On Customer.ID_Customer=s9.ID_Customer
  327. Left Join
  328. (
  329. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  330. From SaleRtnBill
  331. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  332. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,8,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,9,@dtStart))&gt;0 And @bSaleRtn=1
  333. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  334. Group By ID_Customer
  335. )st9 On Customer.ID_Customer=st9.ID_Customer
  336. Left Join
  337. (
  338. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  339. From SaleBill
  340. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  341. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,9,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,10,@dtStart))&gt;0
  342. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  343. Group By ID_Customer
  344. )s10 On Customer.ID_Customer=s10.ID_Customer
  345. Left Join
  346. (
  347. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  348. From SaleRtnBill
  349. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  350. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,9,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,10,@dtStart))&gt;0 And @bSaleRtn=1
  351. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  352. Group By ID_Customer
  353. )st10 On Customer.ID_Customer=st10.ID_Customer
  354. Left Join
  355. (
  356. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  357. From SaleBill
  358. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  359. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,10,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,11,@dtStart))&gt;0
  360. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  361. Group By ID_Customer
  362. )s11 On Customer.ID_Customer=s11.ID_Customer
  363. Left Join
  364. (
  365. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  366. From SaleRtnBill
  367. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  368. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,10,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,11,@dtStart))&gt;0 And @bSaleRtn=1
  369. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  370. Group By ID_Customer
  371. )st11 On Customer.ID_Customer=st11.ID_Customer
  372. Left Join
  373. (
  374. Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
  375. From SaleBill
  376. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  377. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,11,@dtStart))&lt;=0 And DateDiff(day,Date_SaleBill,DateAdd(month,12,@dtStart))&gt;0
  378. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  379. Group By ID_Customer
  380. )s12 On Customer.ID_Customer=s12.ID_Customer
  381. Left Join
  382. (
  383. Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
  384. From SaleRtnBill
  385. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  386. Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,11,@dtStart))&lt;=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,12,@dtStart))&gt;0 And @bSaleRtn=1
  387. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  388. Group By ID_Customer
  389. )st12 On Customer.ID_Customer=st12.ID_Customer
  390. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer) And Zone_Customer BETWEEN ISNULL(@StartZone,Zone_Customer) AND ISNULL(@EndZone,Zone_Customer)
  391. Order By BeginDate_Customer,No_Customer
  392. ">
  393. <Params>
  394. <Param name="@dtStart" type="SaleBill.Date_SaleBill" Index="0" />
  395. <Param name="@bSaleRtn" type="SaleBill.Disable_SaleBill" Index="1" />
  396. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="2" />
  397. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="3" />
  398. <Param name="@StartZone" type="SaleBill.No_Customer" Index="4" />
  399. <Param name="@EndZone" type="SaleBill.No_Customer" Index="5" />
  400. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  401. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  402. </Params>
  403. <Tables>
  404. <Table name="MonthStatistics"/>
  405. </Tables>
  406. </SearchMonthStatistics>
  407. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  408. <Tables>
  409. <Table name="AllCustomer" />
  410. </Tables>
  411. </SearchAllCustomer>
  412. <SearchZoneType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 14">
  413. <Tables>
  414. <Table name="ZoneType" />
  415. </Tables>
  416. </SearchZoneType>
  417. <SearchPrincipal CmdType="Text" CmdText="
  418. Select No_Employee,Name_Employee
  419. From Employee
  420. ORDER BY No_Employee">
  421. <Tables>
  422. <Table name="Principal" />
  423. </Tables>
  424. </SearchPrincipal>
  425. </Search>
  426. </Server>
  427. <Lables>
  428. <Search>
  429. Empty();
  430. NewInstance();
  431. </Search>
  432. <Action>
  433. <![CDATA[
  434. UpdateForm(false,"");
  435. @StartNo_Customer = DBNull();
  436. @EndNo_Customer = DBNull();
  437. @StartZone = DBNull();
  438. @EndZone = DBNull();
  439. @StartNo_Principal= DBNull();
  440. @EndNo_Principal = DBNull();
  441. if(tbCustomerNo1.CValue != "")
  442. {
  443. @StartNo_Customer = tbCustomerNo1.CValue;
  444. }
  445. if(cbZone1.Text != "")
  446. {
  447. @StartZone = cbZone1.Text;
  448. }
  449. if(cbZone2.Text != "")
  450. {
  451. @EndZone = cbZone2.Text;
  452. }
  453. if(tbCustomerNo2.CValue != "")
  454. {
  455. @EndNo_Customer = tbCustomerNo2.CValue;
  456. }
  457. if(cbPrincipal1.Text!="")
  458. {
  459. if(!cbPrincipal1.CheckSelectedItem())
  460. {
  461. MessageBox("请选择有效的业务负责人!",@Title);
  462. cbPrincipal1.Focus();
  463. return;
  464. }
  465. else
  466. {
  467. @StartNo_Principal = cbPrincipal1.SelectedNo;
  468. }
  469. }
  470. if(cbPrincipal2.Text!="")
  471. {
  472. if(!cbPrincipal2.CheckSelectedItem())
  473. {
  474. MessageBox("请选择有效的业务负责人!",@Title);
  475. cbPrincipal2.Focus();
  476. return;
  477. }
  478. else
  479. {
  480. @EndNo_Principal = cbPrincipal2.SelectedNo;
  481. }
  482. }
  483. Search("SearchMonthStatistics",#UI.dtStart,ckCombine.Checked,@StartNo_Customer,@EndNo_Customer,@StartZone,@EndZone,@StartNo_Principal,@EndNo_Principal);
  484. if(RowCount("#MonthStatistics")==0)
  485. {
  486. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  487. }
  488. else
  489. {
  490. switch(@ClickType)
  491. {
  492. case "View":
  493. PrintReport("UIMonthStatistics","UI","MonthStatistics");
  494. break;
  495. default:
  496. ExportReport(@ClickType,"UIMonthStatistics","UI","MonthStatistics");
  497. break;
  498. }
  499. }
  500. ]]>
  501. </Action>
  502. </Lables>
  503. </Form>
  504. </Forms>