FrmSalesStatistics.xml 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSalesStatistics">
  4. <Client>
  5. <Events>
  6. <Load><![CDATA[
  7. @Title="销货统计表";
  8. @ClickType="";
  9. GetSchema();
  10. txtCoNo.CValue=GetCurrentCompanyNo();
  11. txtCoName.CValue=GetCurrentCompanyShortName();
  12. Empty();
  13. NewInstance();
  14. dtStart.CValue=GetCurrentTime();
  15. dtEnd.CValue=GetCurrentTime();
  16. ]]>
  17. <Lable name="CheckChange"/>
  18. </Load>
  19. <Closing>
  20. ;
  21. </Closing>
  22. <Closed>
  23. ;
  24. </Closed>
  25. </Events>
  26. <Mode>
  27. <Search>
  28. <Lable name="Search"/>
  29. </Search>
  30. </Mode>
  31. <Controls>
  32. <IKRadioButton name="ikRadioButton1">
  33. <Events>
  34. <CheckedChanged>
  35. <Lable name="CheckChange"/>
  36. </CheckedChanged>
  37. </Events>
  38. </IKRadioButton>
  39. <IKRadioButton name="ikRadioButton2">
  40. <Events>
  41. <CheckedChanged>
  42. <Lable name="CheckChange"/>
  43. </CheckedChanged>
  44. </Events>
  45. </IKRadioButton>
  46. <IKRadioButton name="ikRadioButton3">
  47. <Events>
  48. <CheckedChanged>
  49. <Lable name="CheckChange"/>
  50. </CheckedChanged>
  51. </Events>
  52. </IKRadioButton>
  53. <IKRadioButton name="ikRadioButton4">
  54. <Events>
  55. <CheckedChanged>
  56. <Lable name="CheckChange"/>
  57. </CheckedChanged>
  58. </Events>
  59. </IKRadioButton>
  60. <IKRadioButton name="ikRadioButton5">
  61. <Events>
  62. <CheckedChanged>
  63. <Lable name="CheckChange"/>
  64. </CheckedChanged>
  65. </Events>
  66. </IKRadioButton>
  67. <IKDateTimePicker name = "dtStart">
  68. <Events>
  69. <CheckedChanged>
  70. dtEnd.Checked = dtStart.Checked;
  71. </CheckedChanged>
  72. <ValueChanged>
  73. dtEnd.CValue = dtStart.CValue;
  74. </ValueChanged>
  75. </Events>
  76. </IKDateTimePicker>
  77. <IKTextButton name="tbSaleBillNo1" >
  78. <Events>
  79. <Click>
  80. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
  81. </Click>
  82. <TextBoxButtonTextChanged>
  83. tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
  84. </TextBoxButtonTextChanged>
  85. </Events>
  86. </IKTextButton>
  87. <IKTextButton name="tbSaleBillNo2" >
  88. <Events>
  89. <Click>
  90. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
  91. </Click>
  92. </Events>
  93. </IKTextButton>
  94. <IKTextButton name="tbCustomerNo1" >
  95. <Events>
  96. <Click>
  97. <![CDATA[
  98. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  99. if( @temp == "" )
  100. return;
  101. tbCustomerNo1.CValue = @temp;
  102. ]]>
  103. </Click>
  104. <TextBoxButtonTextChanged>
  105. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  106. </TextBoxButtonTextChanged>
  107. </Events>
  108. </IKTextButton>
  109. <IKTextButton name="tbCustomerNo2" >
  110. <Events>
  111. <Click>
  112. <![CDATA[
  113. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  114. if( @temp == "" )
  115. return;
  116. tbCustomerNo2.CValue = @temp;
  117. ]]>
  118. </Click>
  119. </Events>
  120. </IKTextButton>
  121. <IKComboBoxEx name="cbPrincipal1" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  122. <Events>
  123. <Reload>
  124. UpdateForm(false, "cbPrincipal1");
  125. Search("SearchPrincipal");
  126. UpdateForm(true, "cbPrincipal1");
  127. </Reload>
  128. <TextChanged>
  129. cbPrincipal2.SelectedName = cbPrincipal1.SelectedName;
  130. cbPrincipal2.SelectedNo=cbPrincipal1.SelectedNo;
  131. </TextChanged>
  132. </Events>
  133. </IKComboBoxEx>
  134. <IKComboBoxEx name="cbPrincipal2" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee" >
  135. <Events>
  136. <Reload>
  137. UpdateForm(false, "cbPrincipal2");
  138. Search("SearchPrincipal");
  139. UpdateForm(true, "cbPrincipal2");
  140. </Reload>
  141. </Events>
  142. </IKComboBoxEx>
  143. <IKComboBoxEx name="cbLocation1" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
  144. <Events>
  145. <Reload>
  146. UpdateForm(false, "cbLocation1");
  147. Search("SearchLocation");
  148. UpdateForm(true, "cbLocation1");
  149. </Reload>
  150. <TextChanged>
  151. cbLocation2.SelectedName = cbLocation1.SelectedName;
  152. cbLocation2.SelectedNo = cbLocation1.SelectedNo;
  153. </TextChanged>
  154. </Events>
  155. </IKComboBoxEx>
  156. <IKComboBoxEx name="cbLocation2" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
  157. <Events>
  158. <Reload>
  159. UpdateForm(false, "cbLocation2");
  160. Search("SearchLocation");
  161. UpdateForm(true, "cbLocation2");
  162. </Reload>
  163. </Events>
  164. </IKComboBoxEx>
  165. <IKTextButton name="tbProduct1" >
  166. <Events>
  167. <Click>
  168. <![CDATA[
  169. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
  170. if( @temp == "" )
  171. return;
  172. tbProduct1.CValue = @temp;
  173. ]]>
  174. </Click>
  175. <TextBoxButtonTextChanged>
  176. tbProduct2.CValue = tbProduct1.CValue;
  177. </TextBoxButtonTextChanged>
  178. </Events>
  179. </IKTextButton>
  180. <IKTextButton name="tbProduct2" >
  181. <Events>
  182. <Click>
  183. <![CDATA[
  184. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
  185. if( @temp == "" )
  186. return;
  187. tbProduct2.CValue = @temp;
  188. ]]>
  189. </Click>
  190. </Events>
  191. </IKTextButton>
  192. <IKComboBoxEx name="cbType1" DataSource="Type" DisplayMember="Type_Product" >
  193. <Events>
  194. <Reload>
  195. UpdateForm(false, "cbType1");
  196. Search("SearchType");
  197. UpdateForm(true, "cbType1");
  198. </Reload>
  199. <TextChanged>
  200. cbType2.Text = cbType1.Text;
  201. </TextChanged>
  202. </Events>
  203. </IKComboBoxEx>
  204. <IKComboBoxEx name="cbType2" DataSource="Type" DisplayMember="Type_Product" >
  205. <Events>
  206. <Reload>
  207. UpdateForm(false, "cbType2");
  208. Search("SearchType");
  209. UpdateForm(true, "cbType2");
  210. </Reload>
  211. </Events>
  212. </IKComboBoxEx>
  213. <IKTextButton name="tbCustomerZone1" >
  214. <Events>
  215. <Click>
  216. <![CDATA[
  217. @temp = ShowSearchBox("CustomerZoneSearch","INFOMATION",tbCustomerZone1.CValue);
  218. if( @temp == "" )
  219. return;
  220. tbCustomerZone1.CValue = @temp;
  221. ]]>
  222. </Click>
  223. <TextBoxButtonTextChanged>
  224. tbCustomerZone2.CValue = tbCustomerZone1.CValue;
  225. </TextBoxButtonTextChanged>
  226. </Events>
  227. </IKTextButton>
  228. <IKTextButton name="tbCustomerZone2" >
  229. <Events>
  230. <Click>
  231. <![CDATA[
  232. @temp = ShowSearchBox("CustomerZoneSearch","INFOMATION",tbCustomerZone2.CValue);
  233. if( @temp == "" )
  234. return;
  235. tbCustomerZone2.CValue = @temp;
  236. ]]>
  237. </Click>
  238. </Events>
  239. </IKTextButton>
  240. <IKButton name="btnView">
  241. <Events>
  242. <Click>
  243. @ClickType="View";
  244. <Lable name="Action"/>
  245. </Click>
  246. </Events>
  247. </IKButton>
  248. <IKButton name="btnExcel">
  249. <Events>
  250. <Click>
  251. @ClickType="Excel";
  252. <Lable name="Action"/>
  253. </Click>
  254. </Events>
  255. </IKButton>
  256. <IKButton name="btnWord">
  257. <Events>
  258. <Click>
  259. @ClickType="Word";
  260. <Lable name="Action"/>
  261. </Click>
  262. </Events>
  263. </IKButton>
  264. <IKButton name="btnPrint">
  265. <Events>
  266. <Click>
  267. @ClickType="PrintToPrinter";
  268. <Lable name="Action"/>
  269. </Click>
  270. </Events>
  271. </IKButton>
  272. </Controls>
  273. <ChildForms>
  274. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="">
  275. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  276. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  277. <DataColumn Index="2" MappingName="#SaleBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  278. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  279. </ChildForm>
  280. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  281. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  282. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  283. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  284. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  285. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  286. </ChildForm>
  287. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  288. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  289. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  290. </ChildForm>
  291. <ChildForm name="CustomerZoneSearch" DataSource="Customer" SearchFunction="SearchAllCustomerZone" SearchFunctionByNo="" MappingName="地区">
  292. <DataColumn Index="0" MappingName="#Customer.Zone_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  293. <DataColumn Index="1" MappingName="#Customer.Country_Customer" HeaderText="国家" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  294. </ChildForm>
  295. </ChildForms>
  296. <FormatString>
  297. <Format name="SearchCustomerCondition">
  298. if(GetRight("客户基本资料","全权查看"))
  299. {
  300. FormatString("");
  301. }
  302. else
  303. {
  304. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  305. }
  306. </Format>
  307. <Format name="SearchBillCondition">
  308. if(GetRight("客户基本资料","全权查看"))
  309. {
  310. FormatString("");
  311. }
  312. else
  313. {
  314. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  315. }
  316. </Format>
  317. </FormatString>
  318. </Client>
  319. <Server>
  320. <Tables>
  321. <Table name="SaleBill" Type="Parent">
  322. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleBill.* FROM SaleBill"/>
  323. </Table>
  324. <Table name="Get" Type="Other">
  325. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 convert(datetime,0) as StartDate ,
  326. convert(datetime,0) as EndDate ,
  327. convert(nvarchar(64),'') as StartNo_SaleBill ,
  328. convert(nvarchar(64),'') as EndNo_SaleBill ,
  329. convert(nvarchar(64),'') as StartNo_Customer ,
  330. convert(nvarchar(64),'') as EndNo_Customer ,
  331. convert(nvarchar(64),'') as StartNo_Principal ,
  332. convert(nvarchar(64),'') as EndNo_Principal ,
  333. convert(nvarchar(64),'') as StartNo_Location ,
  334. convert(nvarchar(64),'') as EndNo_Location ,
  335. convert(nvarchar(64),'') as StartNo_Product,
  336. convert(nvarchar(64),'') as EndNo_Product ,
  337. convert(nvarchar(64),'') as StartType_Product ,
  338. convert(nvarchar(64),'') as EndType_Product,
  339. convert(nvarchar(64),'') as Company ,
  340. convert(nvarchar(64),'') as Name_Create,
  341. convert(bit,0) as Combine,
  342. convert(nvarchar(64),'') as StartZone_Customer,
  343. convert(nvarchar(64),'') as EndZone_Customer
  344. "/>
  345. </Table>
  346. <Table name="FrmSalesStatisticsLocation" Type="Other">
  347. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Location, CONVERT(NVARCHAR(64),'') AS Name_Location,CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  348. CONVERT(DECIMAL,0.00) AS Quantity,
  349. CONVERT(DECIMAL,0.00) AS MoneySum,
  350. CONVERT(DECIMAL,0.00) AS Amount,
  351. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  352. "/>
  353. </Table>
  354. <Table name="FrmSalesStatisticsProduct" Type="Other">
  355. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Product, CONVERT(NVARCHAR(64),'') AS Name_Product,CONVERT(NVARCHAR(64),'') AS Name_Location,
  356. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  357. CONVERT(DECIMAL,0.00) AS Price_Product,
  358. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  359. CONVERT(DECIMAL,0.00) AS Quantity,
  360. CONVERT(DECIMAL,0.00) AS MoneySum,
  361. CONVERT(DECIMAL,0.00) AS Amount,
  362. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  363. "/>
  364. </Table>
  365. <Table name="FrmSalesStatisticsPrincipal" Type="Other">
  366. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Employee, CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  367. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  368. CONVERT(DECIMAL,0.00) AS TaxAmount,
  369. CONVERT(DECIMAL,0.00) AS Quantity,
  370. CONVERT(DECIMAL,0.00) AS MoneySum,
  371. CONVERT(DECIMAL,0.00) AS Amount,
  372. CONVERT(DECIMAL,0.00) AS CurrencyAmount,
  373. CONVERT(NVARCHAR(64),'') AS Type_Customer,
  374. CONVERT(NVARCHAR(64),'') AS Zone_Customer
  375. "/>
  376. </Table>
  377. <Table name="FrmSalesStatisticsCustomer" Type="Other">
  378. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Customer, CONVERT(NVARCHAR(64),'') AS ShortName_Customer,CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  379. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  380. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  381. CONVERT(DECIMAL,0.00) AS TaxAmount,
  382. CONVERT(DECIMAL,0.00) AS Quantity,
  383. CONVERT(DECIMAL,0.00) AS MoneySum,
  384. CONVERT(DECIMAL,0.00) AS Amount,
  385. CONVERT(DECIMAL,0.00) AS CurrencyAmount,
  386. CONVERT(NVARCHAR(64),'') AS Type_Customer,
  387. CONVERT(NVARCHAR(64),'') AS Zone_Customer
  388. "/>
  389. </Table>
  390. </Tables>
  391. <Search>
  392. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  393. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  394. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  395. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  396. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal ,Employee.Name_Employee as Principal_SaleBill
  397. FROM SaleBill
  398. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  399. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  400. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  401. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  402. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  403. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal">
  404. <Tables>
  405. <Table name="AllBill" />
  406. </Tables>
  407. </SearchAllBill>
  408. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  409. <Tables>
  410. <Table name="AllCustomer" />
  411. </Tables>
  412. </SearchAllCustomer>
  413. <SearchAllCustomerZone CmdType="Text" CmdText="Select Distinct Zone_Customer
  414. ,Country_Customer
  415. From Customer
  416. ">
  417. <Tables>
  418. <Table name="AllCustomer" />
  419. </Tables>
  420. </SearchAllCustomerZone>
  421. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  422. <Tables>
  423. <Table name="AllProduct" />
  424. </Tables>
  425. </SearchAllProduct>
  426. <SearchPrincipal CmdType="Text" CmdText="SELECT DISTINCT No_Employee,Name_Employee
  427. FROM Employee
  428. ORDER BY No_Employee
  429. ">
  430. <Tables>
  431. <Table name="Principal" />
  432. </Tables>
  433. </SearchPrincipal>
  434. <SearchLocation CmdType="Text" CmdText=" SELECT Location.No_Location, Location.Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY Location.No_Location">
  435. <Tables>
  436. <Table name="Location" />
  437. </Tables>
  438. </SearchLocation>
  439. <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
  440. <Tables>
  441. <Table name="Type"/>
  442. </Tables>
  443. </SearchType>
  444. <SearchFrmSalesStatisticsLocation CmdType="Text" CmdText=" CREATE TABLE Get
  445. (StartDate DATETIME,
  446. EndDate DATETIME,
  447. StartNo_SaleBill nvarchar(64),
  448. EndNo_SaleBill nvarchar(64),
  449. StartNo_Customer nvarchar(64),
  450. EndNo_Customer nvarchar(64),
  451. StartNo_Principal nvarchar(64),
  452. EndNo_Principal nvarchar(64),
  453. StartNo_Location nvarchar(64),
  454. EndNo_Location nvarchar(64),
  455. StartNo_Product nvarchar(64),
  456. EndNo_Product nvarchar(64),
  457. StartType_Product nvarchar(64),
  458. EndType_Product nvarchar(64),
  459. Company nvarchar(64),
  460. Name_Create nvarchar(64),
  461. Combine bit,
  462. StartZone_Customer nvarchar(64),
  463. EndZone_Customer nvarchar(64)
  464. )
  465. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  466. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  467. StartNo_Location,EndNo_Location,Company,Name_Create,
  468. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine,
  469. StartZone_Customer,EndZone_Customer)
  470. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  471. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  472. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  473. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine,
  474. isnull(@StartZone_Customer,''),isnull(@EndZone_Customer,''))
  475. SELECT * FROM Get
  476. DROP TABLE Get
  477. declare @CessOut decimal(14,4)
  478. Select @CessOut=CessOut_SystemSetting/100 From SystemSetting
  479. Select Product.No_Product,Product.Name_Product,Product.Unit_Product,Location.Name_Location,ab.Quantity,ab.Currency,ab.UnitPrice,
  480. ab.MoneySum,ab.Amount,ab.TaxCurrency,ab.Amount As CurrencyAmount,ab.No
  481. From
  482. (
  483. (
  484. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleBill As Date,Type='S',
  485. Currency_SaleBill As Currency,TaxCurrency_SaleBill As TaxCurrency,No='销'+No_SaleBill,
  486. UnitPrice_SaleBillProduct As UnitPrice,Quantity_SaleBillProduct As Quantity,
  487. MoneySum = case SaleBill.TaxCurrency_SaleBill
  488. When '内含' Then (Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))-Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))*@CessOut/(1+@CessOut)))
  489. else Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
  490. Amount=case SaleBill.TaxCurrency_SaleBill
  491. When '外加' Then (Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))*@CessOut))
  492. else Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end
  493. From SaleBillProduct
  494. Join SaleBill ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  495. Where SaleBill.ID_Assessor Is Not Null AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  496. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  497. )
  498. union all
  499. (
  500. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleRtnBill As Date,Type='R',
  501. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  502. UnitPrice_SaleRtnBillProduct As UnitPrice,-Quantity_SaleRtnBillProduct As Quantity,
  503. MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
  504. When '内含' Then -(Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))-Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut/(1+@CessOut)))
  505. else -Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  506. Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  507. When '外加' Then -(Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut))
  508. else -Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end
  509. From SaleRtnBillProduct
  510. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  511. Where SaleRtnBill.ID_Assessor Is Not Null and @PrintSaleRtn=1
  512. )
  513. )ab
  514. LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  515. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  516. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  517. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  518. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  519. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  520. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  521. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  522. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  523. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  524. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  525. AND Zone_Customer BETWEEN ISNULL(@StartZone_Customer,Zone_Customer) AND ISNULL(@EndZone_Customer,Zone_Customer)
  526. Order By No_Location,No_Product,Type desc,No
  527. ">
  528. <Params>
  529. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  530. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  531. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  532. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  533. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  534. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  535. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  536. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  537. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  538. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  539. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  540. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  541. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  542. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  543. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  544. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  545. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  546. <Param name="@Combine" type="SaleBill.Disable_SaleBill" Index="17" />
  547. <Param name="@PrintSaleRtn" type="SaleBill.Disable_SaleBill" Index="18" />
  548. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="19" />
  549. <Param name="@StartZone_Customer" type="SaleBill.No_Customer" Index="20" />
  550. <Param name="@EndZone_Customer" type="SaleBill.No_Customer" Index="21" />
  551. </Params>
  552. <Tables>
  553. <Table name="Get" />
  554. <Table name="FrmSalesStatisticsLocation"/>
  555. </Tables>
  556. </SearchFrmSalesStatisticsLocation>
  557. <SearchFrmSalesStatisticsProduct CmdType="Text" CmdText="
  558. CREATE TABLE Get
  559. (StartDate DATETIME,
  560. EndDate DATETIME,
  561. StartNo_SaleBill nvarchar(64),
  562. EndNo_SaleBill nvarchar(64),
  563. StartNo_Customer nvarchar(64),
  564. EndNo_Customer nvarchar(64),
  565. StartNo_Principal nvarchar(64),
  566. EndNo_Principal nvarchar(64),
  567. StartNo_Location nvarchar(64),
  568. EndNo_Location nvarchar(64),
  569. StartNo_Product nvarchar(64),
  570. EndNo_Product nvarchar(64),
  571. StartType_Product nvarchar(64),
  572. EndType_Product nvarchar(64),
  573. Company nvarchar(64),
  574. Name_Create nvarchar(64),
  575. Combine bit,
  576. StartZone_Customer nvarchar(64),
  577. EndZone_Customer nvarchar(64)
  578. )
  579. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  580. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  581. StartNo_Location,EndNo_Location,Company,Name_Create,
  582. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine,
  583. StartZone_Customer,EndZone_Customer)
  584. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  585. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  586. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  587. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine,
  588. isnull(@StartZone_Customer,''),isnull(@EndZone_Customer,''))
  589. SELECT * FROM Get
  590. DROP TABLE Get
  591. declare @CessOut decimal(14,4)
  592. Select @CessOut=CessOut_SystemSetting/100 From SystemSetting
  593. Select Product.No_Product,Product.Name_Product,Product.Unit_Product,Location.Name_Location,ab.Quantity,ab.Currency,ab.UnitPrice,
  594. ab.MoneySum,ab.Amount,ab.TaxCurrency,ab.Amount As CurrencyAmount,ab.No
  595. From
  596. (
  597. (
  598. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleBill As Date,Type='S',
  599. Currency_SaleBill As Currency,TaxCurrency_SaleBill As TaxCurrency,No='销'+No_SaleBill,
  600. UnitPrice_SaleBillProduct As UnitPrice,Quantity_SaleBillProduct As Quantity,
  601. MoneySum = case SaleBill.TaxCurrency_SaleBill
  602. When '内含' Then (Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))-Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))*@CessOut/(1+@CessOut)))
  603. else Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
  604. Amount=case SaleBill.TaxCurrency_SaleBill
  605. When '外加' Then (Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))*@CessOut))
  606. else Convert(Decimal(18,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end
  607. From SaleBillProduct
  608. Join SaleBill ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  609. Where SaleBill.ID_Assessor Is Not Null AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  610. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  611. )
  612. union all
  613. (
  614. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleRtnBill As Date,Type='R',
  615. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  616. UnitPrice_SaleRtnBillProduct As UnitPrice,-Quantity_SaleRtnBillProduct As Quantity,
  617. MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
  618. When '内含' Then -(Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))-Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut/(1+@CessOut)))
  619. else -Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  620. Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  621. When '外加' Then -(Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut))
  622. else -Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end
  623. From SaleRtnBillProduct
  624. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  625. Where SaleRtnBill.ID_Assessor Is Not Null and @PrintSaleRtn=1
  626. )
  627. )ab
  628. LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  629. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  630. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  631. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  632. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  633. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  634. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  635. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  636. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  637. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  638. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  639. AND Zone_Customer BETWEEN ISNULL(@StartZone_Customer,Zone_Customer) AND ISNULL(@EndZone_Customer,Zone_Customer)
  640. Order By No_Product,Type desc,Date
  641. ">
  642. <Params>
  643. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  644. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  645. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  646. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  647. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  648. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  649. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  650. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  651. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  652. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  653. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  654. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  655. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  656. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  657. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  658. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  659. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  660. <Param name="@Combine" type="SaleBill.Disable_SaleBill" Index="17" />
  661. <Param name="@PrintSaleRtn" type="SaleBill.Disable_SaleBill" Index="18" />
  662. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="19" />
  663. <Param name="@StartZone_Customer" type="SaleBill.No_Customer" Index="20" />
  664. <Param name="@EndZone_Customer" type="SaleBill.No_Customer" Index="21" />
  665. </Params>
  666. <Tables>
  667. <Table name="Get" />
  668. <Table name="FrmSalesStatisticsProduct"/>
  669. </Tables>
  670. </SearchFrmSalesStatisticsProduct>
  671. <SearchFrmSalesStatisticsCustomer CmdType="Text" CmdText=" CREATE TABLE Get
  672. (StartDate DATETIME,
  673. EndDate DATETIME,
  674. StartNo_SaleBill nvarchar(64),
  675. EndNo_SaleBill nvarchar(64),
  676. StartNo_Customer nvarchar(64),
  677. EndNo_Customer nvarchar(64),
  678. StartNo_Principal nvarchar(64),
  679. EndNo_Principal nvarchar(64),
  680. StartNo_Location nvarchar(64),
  681. EndNo_Location nvarchar(64),
  682. StartNo_Product nvarchar(64),
  683. EndNo_Product nvarchar(64),
  684. StartType_Product nvarchar(64),
  685. EndType_Product nvarchar(64),
  686. Company nvarchar(64),
  687. Name_Create nvarchar(64),
  688. Combine bit,
  689. StartZone_Customer nvarchar(64),
  690. EndZone_Customer nvarchar(64)
  691. )
  692. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  693. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  694. StartNo_Location,EndNo_Location,Company,Name_Create,
  695. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine,
  696. StartZone_Customer,EndZone_Customer)
  697. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  698. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  699. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  700. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine,
  701. isnull(@StartZone_Customer,''),isnull(@EndZone_Customer,''))
  702. SELECT * FROM Get
  703. DROP TABLE Get
  704. Select Customer.No_Customer,Customer.ShortName_Customer,Name_Employee As Principal,Currency,TaxCurrency,No,Amount,GoodsAmount,TaxAmount,LocalAmount=Amount
  705. ,Type_Customer,Zone_Customer
  706. From
  707. (
  708. (
  709. Select ID_Customer,ID_Principal,Date_SaleBill As Date,Type='S',ID_Location,
  710. Currency_SaleBill As Currency,TaxCurrency_SaleBill As TaxCurrency,No='销'+No_SaleBill,
  711. Amount_SaleBill As Amount,GoodsAmount_SaleBill As GoodsAmount,TaxAmount_SaleBill As TaxAmount
  712. From SaleBill
  713. Where SaleBill.ID_Assessor Is Not Null AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  714. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  715. )
  716. union all
  717. (
  718. Select ID_Customer,ID_Principal,Date_SaleRtnBill As Date,Type='R',ID_Location,
  719. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  720. -Amount_SaleRtnBill As Amount,-GoodsAmount_SaleRtnBill As GoodsAmount,-TaxAmount_SaleRtnBill As TaxAmount
  721. From SaleRtnBill
  722. Where SaleRtnBill.ID_Assessor Is Not Null and @PrintSaleRtn=1
  723. )
  724. )ab
  725. --LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  726. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  727. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  728. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  729. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  730. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  731. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  732. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  733. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  734. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  735. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  736. AND Zone_Customer BETWEEN ISNULL(@StartZone_Customer,Zone_Customer) AND ISNULL(@EndZone_Customer,Zone_Customer)
  737. Order By No_Customer,Type desc,No
  738. ">
  739. <Params>
  740. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  741. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  742. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  743. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  744. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  745. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  746. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  747. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  748. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  749. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  750. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  751. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  752. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  753. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  754. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  755. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  756. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  757. <Param name="@Combine" type="SaleBill.Disable_SaleBill" Index="17" />
  758. <Param name="@PrintSaleRtn" type="SaleBill.Disable_SaleBill" Index="18" />
  759. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="19" />
  760. <Param name="@StartZone_Customer" type="SaleBill.No_Customer" Index="20" />
  761. <Param name="@EndZone_Customer" type="SaleBill.No_Customer" Index="21" />
  762. </Params>
  763. <Tables>
  764. <Table name="Get" />
  765. <Table name="FrmSalesStatisticsCustomer"/>
  766. </Tables>
  767. </SearchFrmSalesStatisticsCustomer>
  768. <SearchFrmSalesStatisticsPrincipal CmdType="Text" CmdText="CREATE TABLE Get
  769. (StartDate DATETIME,
  770. EndDate DATETIME,
  771. StartNo_SaleBill nvarchar(64),
  772. EndNo_SaleBill nvarchar(64),
  773. StartNo_Customer nvarchar(64),
  774. EndNo_Customer nvarchar(64),
  775. StartNo_Principal nvarchar(64),
  776. EndNo_Principal nvarchar(64),
  777. StartNo_Location nvarchar(64),
  778. EndNo_Location nvarchar(64),
  779. StartNo_Product nvarchar(64),
  780. EndNo_Product nvarchar(64),
  781. StartType_Product nvarchar(64),
  782. EndType_Product nvarchar(64),
  783. Company nvarchar(64),
  784. Name_Create nvarchar(64),
  785. Combine bit,
  786. StartZone_Customer nvarchar(64),
  787. EndZone_Customer nvarchar(64)
  788. )
  789. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  790. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  791. StartNo_Location,EndNo_Location,Company,Name_Create,
  792. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine,
  793. StartZone_Customer,EndZone_Customer)
  794. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  795. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  796. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  797. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine,
  798. isnull(@StartZone_Customer,''),isnull(@EndZone_Customer,''))
  799. SELECT * FROM Get
  800. DROP TABLE Get
  801. Select Customer.No_Customer,Customer.ShortName_Customer,Name_Employee As Principal,No_Employee As No_Principal,Currency,TaxCurrency,No,Amount,GoodsAmount,TaxAmount,LocalAmount=Amount
  802. ,Type_Customer,Zone_Customer
  803. From
  804. (
  805. (
  806. Select ID_Customer,ID_Principal,Date_SaleBill As Date,Type='S',ID_Location,
  807. Currency_SaleBill As Currency,TaxCurrency_SaleBill As TaxCurrency,No='销'+No_SaleBill,
  808. Amount_SaleBill As Amount,GoodsAmount_SaleBill As GoodsAmount,TaxAmount_SaleBill As TaxAmount
  809. From SaleBill
  810. Where SaleBill.ID_Assessor Is Not Null AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  811. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  812. )
  813. union all
  814. (
  815. Select ID_Customer,ID_Principal,Date_SaleRtnBill As Date,Type='R',ID_Location,
  816. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  817. -Amount_SaleRtnBill As Amount,-GoodsAmount_SaleRtnBill As GoodsAmount,-TaxAmount_SaleRtnBill As TaxAmount
  818. From SaleRtnBill
  819. Where SaleRtnBill.ID_Assessor Is Not Null and @PrintSaleRtn=1
  820. )
  821. )ab
  822. --LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  823. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  824. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  825. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  826. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  827. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  828. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  829. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  830. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  831. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  832. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  833. AND Zone_Customer BETWEEN ISNULL(@StartZone_Customer,Zone_Customer) AND ISNULL(@EndZone_Customer,Zone_Customer)
  834. Order By Principal,No_Customer,Type desc,No
  835. ">
  836. <Params>
  837. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  838. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  839. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  840. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  841. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  842. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  843. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  844. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  845. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  846. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  847. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  848. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  849. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  850. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  851. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  852. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  853. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  854. <Param name="@Combine" type="SaleBill.Disable_SaleBill" Index="17" />
  855. <Param name="@PrintSaleRtn" type="SaleBill.Disable_SaleBill" Index="18" />
  856. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="19" />
  857. <Param name="@StartZone_Customer" type="SaleBill.No_Customer" Index="20" />
  858. <Param name="@EndZone_Customer" type="SaleBill.No_Customer" Index="21" />
  859. </Params>
  860. <Tables>
  861. <Table name="Get" />
  862. <Table name="FrmSalesStatisticsPrincipal"/>
  863. </Tables>
  864. </SearchFrmSalesStatisticsPrincipal>
  865. <SearchFrmSalesStatisticsBillType CmdType="Text" CmdText=" CREATE TABLE Get
  866. (StartDate DATETIME,
  867. EndDate DATETIME,
  868. StartNo_SaleBill nvarchar(64),
  869. EndNo_SaleBill nvarchar(64),
  870. StartNo_Customer nvarchar(64),
  871. EndNo_Customer nvarchar(64),
  872. StartNo_Principal nvarchar(64),
  873. EndNo_Principal nvarchar(64),
  874. StartNo_Location nvarchar(64),
  875. EndNo_Location nvarchar(64),
  876. StartNo_Product nvarchar(64),
  877. EndNo_Product nvarchar(64),
  878. StartType_Product nvarchar(64),
  879. EndType_Product nvarchar(64),
  880. Company nvarchar(64),
  881. Name_Create nvarchar(64),
  882. Combine bit,
  883. StartZone_Customer nvarchar(64),
  884. EndZone_Customer nvarchar(64)
  885. )
  886. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  887. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  888. StartNo_Location,EndNo_Location,Company,Name_Create,
  889. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine,
  890. StartZone_Customer,EndZone_Customer)
  891. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  892. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  893. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  894. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine,
  895. isnull(@StartZone_Customer,''),isnull(@EndZone_Customer,''))
  896. SELECT * FROM Get
  897. DROP TABLE Get
  898. Select TypeName,No,Date,Customer.ShortName_Customer,Name_Employee As Principal,Location.Name_Location,Currency,TaxCurrency,Amount,GoodsAmount,TaxAmount,LocalAmount=Amount
  899. ,Type_Customer,Zone_Customer,No_Customer
  900. From
  901. (
  902. (
  903. Select ID_Customer,ID_Principal,Date_SaleBill As Date,Type='S',ID_Location,TypeName='销货',
  904. Currency_SaleBill As Currency,TaxCurrency_SaleBill As TaxCurrency,No=No_SaleBill,
  905. Amount_SaleBill As Amount,GoodsAmount_SaleBill As GoodsAmount,TaxAmount_SaleBill As TaxAmount
  906. From SaleBill
  907. Where SaleBill.ID_Assessor Is Not Null AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  908. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  909. )
  910. union all
  911. (
  912. Select ID_Customer,ID_Principal,Date_SaleRtnBill As Date,Type='R',ID_Location,TypeName='销退',
  913. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No=No_SaleRtnBill,
  914. -Amount_SaleRtnBill As Amount,-GoodsAmount_SaleRtnBill As GoodsAmount,-TaxAmount_SaleRtnBill As TaxAmount
  915. From SaleRtnBill
  916. Where SaleRtnBill.ID_Assessor Is Not Null and @PrintSaleRtn=1
  917. )
  918. )ab
  919. --LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  920. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  921. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  922. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  923. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  924. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  925. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  926. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  927. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  928. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  929. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  930. AND Zone_Customer BETWEEN ISNULL(@StartZone_Customer,Zone_Customer) AND ISNULL(@EndZone_Customer,Zone_Customer)
  931. Order By Type desc,No
  932. ">
  933. <Params>
  934. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  935. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  936. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  937. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  938. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  939. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  940. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  941. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  942. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  943. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  944. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  945. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  946. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  947. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  948. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  949. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  950. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  951. <Param name="@Combine" type="SaleBill.Disable_SaleBill" Index="17" />
  952. <Param name="@PrintSaleRtn" type="SaleBill.Disable_SaleBill" Index="18" />
  953. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="19" />
  954. <Param name="@StartZone_Customer" type="SaleBill.No_Customer" Index="20" />
  955. <Param name="@EndZone_Customer" type="SaleBill.No_Customer" Index="21" />
  956. </Params>
  957. <Tables>
  958. <Table name="Get" />
  959. <Table name="FrmSalesStatisticsBillType"/>
  960. </Tables>
  961. </SearchFrmSalesStatisticsBillType>
  962. </Search>
  963. </Server>
  964. <Lables>
  965. <Search>
  966. </Search>
  967. <Action>
  968. <![CDATA[
  969. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false &&ikRadioButton5.Checked==false)
  970. {
  971. MessageBox("请选择格式!",@Title);
  972. return;
  973. }
  974. Empty();
  975. @Company=GetCurrentCompanyNo();
  976. @Name_Create = GetCurrentUser();
  977. @StartDate = DBNull();
  978. @EndDate = DBNull();
  979. @StartNo_SaleBill = DBNull();
  980. @EndNo_SaleBill = DBNull();
  981. @StartNo_Customer = DBNull();
  982. @EndNo_Customer = DBNull();
  983. @StartNo_Principal = DBNull();
  984. @EndNo_Principal = DBNull();
  985. @StartNo_Location = DBNull();
  986. @EndNo_Location = DBNull();
  987. @StartNo_Product = DBNull();
  988. @EndNo_Product = DBNull();
  989. @StartType_Product = DBNull();
  990. @EndType_Product = DBNull();
  991. @StartZone_Customer = DBNull();
  992. @EndZone_Customer = DBNull();
  993. if(dtStart.Checked==true)
  994. @StartDate = dtStart.CValue;
  995. if(dtEnd.Checked==true)
  996. @EndDate = dtEnd.CValue;
  997. if(tbSaleBillNo1.CValue != "")
  998. {@StartNo_SaleBill = tbSaleBillNo1.CValue;
  999. }
  1000. if(tbSaleBillNo2.CValue != "")
  1001. {@EndNo_SaleBill = tbSaleBillNo2.CValue;
  1002. }
  1003. if(tbCustomerNo1.CValue != "")
  1004. {@StartNo_Customer = tbCustomerNo1.CValue;
  1005. }
  1006. if(tbCustomerNo2.CValue != "")
  1007. {@EndNo_Customer = tbCustomerNo2.CValue;
  1008. }
  1009. if(cbPrincipal1.Text!="")
  1010. {
  1011. if(!cbPrincipal1.CheckSelectedItem())
  1012. {
  1013. MessageBox("请选择有效的业务负责人!",@Title);
  1014. cbPrincipal1.Focus();
  1015. return;
  1016. }
  1017. else
  1018. {
  1019. @StartNo_Principal = cbPrincipal1.SelectedNo;
  1020. }
  1021. }
  1022. if(cbPrincipal2.Text!="")
  1023. {
  1024. if(!cbPrincipal2.CheckSelectedItem())
  1025. {
  1026. MessageBox("请选择有效的业务负责人!",@Title);
  1027. cbPrincipal2.Focus();
  1028. return;
  1029. }
  1030. else
  1031. {
  1032. @EndNo_Principal = cbPrincipal2.SelectedNo;
  1033. }
  1034. }
  1035. if(cbLocation1.Text!="")
  1036. {
  1037. if(!cbLocation1.CheckSelectedItem())
  1038. {
  1039. MessageBox("请选择有效的仓库!",@Title);
  1040. cbLocation1.Focus();
  1041. return;
  1042. }
  1043. else
  1044. {
  1045. @StartNo_Location = cbLocation1.SelectedNo;
  1046. }
  1047. }
  1048. if(cbLocation2.Text!="")
  1049. {
  1050. if(!cbLocation2.CheckSelectedItem())
  1051. {
  1052. MessageBox("请选择有效的仓库!",@Title);
  1053. cbLocation2.Focus();
  1054. return;
  1055. }
  1056. else
  1057. {
  1058. @EndNo_Location = cbLocation2.SelectedNo;
  1059. }
  1060. }
  1061. if(tbProduct1.CValue != "")
  1062. @StartNo_Product = tbProduct1.CValue;
  1063. if(tbProduct2.CValue != "")
  1064. @EndNo_Product = tbProduct2.CValue;
  1065. if(cbType1.Text != "")
  1066. @StartType_Product = cbType1.Text;
  1067. if(cbType2.Text != "")
  1068. @EndType_Product = cbType2.Text;
  1069. if(tbCustomerZone1.CValue != "")
  1070. {@StartZone_Customer = tbCustomerZone1.CValue;
  1071. }
  1072. if(tbCustomerZone2.CValue != "")
  1073. {@EndZone_Customer = tbCustomerZone2.CValue;
  1074. }
  1075. if(ikRadioButton4.Checked)
  1076. {
  1077. Search("SearchFrmSalesStatisticsLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  1078. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  1079. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked,ckSaleRtn.Checked,GetFieldRight("销货单","特价单","查看"),@StartZone_Customer,@EndZone_Customer);
  1080. if(RowCount("#FrmSalesStatisticsLocation")==0)
  1081. {
  1082. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  1083. }
  1084. else
  1085. {
  1086. switch(@ClickType)
  1087. {
  1088. case "View":
  1089. PrintReport("GetFrmSalesStatisticsLocation","Get","FrmSalesStatisticsLocation");
  1090. break;
  1091. default:
  1092. ExportReport(@ClickType,"GetFrmSalesStatisticsLocation","Get","FrmSalesStatisticsLocation");
  1093. break;
  1094. }
  1095. }
  1096. }
  1097. if(ikRadioButton2.Checked)
  1098. {
  1099. Search("SearchFrmSalesStatisticsProduct",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  1100. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  1101. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked,ckSaleRtn.Checked,GetFieldRight("销货单","特价单","查看"),@StartZone_Customer,@EndZone_Customer);
  1102. if(RowCount("#FrmSalesStatisticsProduct") ==0)
  1103. {
  1104. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  1105. }
  1106. else
  1107. {
  1108. switch(@ClickType)
  1109. {
  1110. case "View":
  1111. PrintReport("GetFrmSalesStatisticsProduct","Get","FrmSalesStatisticsProduct");
  1112. break;
  1113. default:
  1114. ExportReport(@ClickType,"GetFrmSalesStatisticsProduct","Get","FrmSalesStatisticsProduct");
  1115. break;
  1116. }
  1117. }
  1118. }
  1119. if(ikRadioButton1.Checked)
  1120. {
  1121. Search("SearchFrmSalesStatisticsPrincipal",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  1122. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  1123. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked,ckSaleRtn.Checked,GetFieldRight("销货单","特价单","查看"),@StartZone_Customer,@EndZone_Customer);
  1124. if(RowCount("#FrmSalesStatisticsPrincipal") ==0)
  1125. {
  1126. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  1127. }
  1128. else
  1129. {
  1130. switch(@ClickType)
  1131. {
  1132. case "View":
  1133. PrintReport("GetFrmSalesStatisticsPrincipal","Get","FrmSalesStatisticsPrincipal");
  1134. break;
  1135. default:
  1136. ExportReport(@ClickType,"GetFrmSalesStatisticsPrincipal","Get","FrmSalesStatisticsPrincipal");
  1137. break;
  1138. }
  1139. }
  1140. }
  1141. if(ikRadioButton3.Checked)
  1142. {
  1143. Search("SearchFrmSalesStatisticsCustomer",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  1144. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  1145. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked,ckSaleRtn.Checked,GetFieldRight("销货单","特价单","查看"),@StartZone_Customer,@EndZone_Customer);
  1146. if(RowCount("#FrmSalesStatisticsCustomer") ==0)
  1147. {
  1148. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  1149. }
  1150. else
  1151. {
  1152. switch(@ClickType)
  1153. {
  1154. case "View":
  1155. PrintReport("GetFrmSalesStatisticsCustomer","Get","FrmSalesStatisticsCustomer");
  1156. break;
  1157. default:
  1158. ExportReport(@ClickType,"GetFrmSalesStatisticsCustomer","Get","FrmSalesStatisticsCustomer");
  1159. break;
  1160. }
  1161. }
  1162. }
  1163. if(ikRadioButton5.Checked)
  1164. {
  1165. Search("SearchFrmSalesStatisticsBillType",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  1166. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  1167. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked,ckSaleRtn.Checked,GetFieldRight("销货单","特价单","查看"),@StartZone_Customer,@EndZone_Customer);
  1168. if(RowCount("#FrmSalesStatisticsBillType")==0)
  1169. {
  1170. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  1171. }
  1172. else
  1173. {
  1174. switch(@ClickType)
  1175. {
  1176. case "View":
  1177. PrintReport("GetFrmSalesStatisticsBillType","Get","FrmSalesStatisticsBillType");
  1178. break;
  1179. default:
  1180. ExportReport(@ClickType,"GetFrmSalesStatisticsBillType","Get","FrmSalesStatisticsBillType");
  1181. break;
  1182. }
  1183. }
  1184. }
  1185. ]]>
  1186. </Action>
  1187. <CheckChange>
  1188. if(ikRadioButton1.Checked||ikRadioButton3.Checked||ikRadioButton5.Checked)
  1189. {
  1190. tbProduct1.ReadOnly=true;
  1191. tbProduct2.ReadOnly=true;
  1192. tbProduct1.IKButton.Enabled=false;
  1193. tbProduct2.IKButton.Enabled=false;
  1194. cbType1.Enabled=false;
  1195. cbType2.Enabled=false;
  1196. }
  1197. else
  1198. {
  1199. tbProduct1.ReadOnly=false;
  1200. tbProduct2.ReadOnly=false;
  1201. tbProduct1.IKButton.Enabled=true;
  1202. tbProduct2.IKButton.Enabled=true;
  1203. cbType1.Enabled=true;
  1204. cbType2.Enabled=true;
  1205. }
  1206. </CheckChange>
  1207. </Lables>
  1208. </Form>
  1209. </Forms>