FrmSaleRtnStatistics.xml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSaleRtnStatistics">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销退统计表";
  9. @ClickType="";
  10. GetSchema();
  11. txtCoNo.CValue=GetCurrentCompanyNo();
  12. txtCoName.CValue=GetCurrentCompanyShortName();
  13. Empty();
  14. NewInstance();
  15. dtStart.CValue=GetCurrentTime();
  16. dtEnd.CValue=GetCurrentTime();
  17. ]]>
  18. <Lable name="CheckChange"/>
  19. </Load>
  20. <Closing>
  21. ;
  22. </Closing>
  23. <Closed>
  24. ;
  25. </Closed>
  26. </Events>
  27. <Mode>
  28. <Search>
  29. <Lable name="Search"/>
  30. </Search>
  31. </Mode>
  32. <Controls>
  33. <IKRadioButton name="ikRadioButton1">
  34. <Events>
  35. <CheckedChanged>
  36. <Lable name="CheckChange"/>
  37. </CheckedChanged>
  38. </Events>
  39. </IKRadioButton>
  40. <IKRadioButton name="ikRadioButton2">
  41. <Events>
  42. <CheckedChanged>
  43. <Lable name="CheckChange"/>
  44. </CheckedChanged>
  45. </Events>
  46. </IKRadioButton>
  47. <IKRadioButton name="ikRadioButton3">
  48. <Events>
  49. <CheckedChanged>
  50. <Lable name="CheckChange"/>
  51. </CheckedChanged>
  52. </Events>
  53. </IKRadioButton>
  54. <IKRadioButton name="ikRadioButton4">
  55. <Events>
  56. <CheckedChanged>
  57. <Lable name="CheckChange"/>
  58. </CheckedChanged>
  59. </Events>
  60. </IKRadioButton>
  61. <IKDateTimePicker name = "dtStart">
  62. <Events>
  63. <CheckedChanged>
  64. dtEnd.Checked = dtStart.Checked;
  65. </CheckedChanged>
  66. <ValueChanged>
  67. dtEnd.CValue = dtStart.CValue;
  68. </ValueChanged>
  69. </Events>
  70. </IKDateTimePicker>
  71. <IKTextButton name="tbSaleRtnBillNo1" >
  72. <Events>
  73. <Click>
  74. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleRtnBillNo1",tbSaleRtnBillNo1.CValue);
  75. </Click>
  76. <TextBoxButtonTextChanged>
  77. tbSaleRtnBillNo2.CValue = tbSaleRtnBillNo1.CValue;
  78. </TextBoxButtonTextChanged>
  79. </Events>
  80. </IKTextButton>
  81. <IKTextButton name="tbSaleRtnBillNo2" >
  82. <Events>
  83. <Click>
  84. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleRtnBillNo2",tbSaleRtnBillNo2.CValue);
  85. </Click>
  86. </Events>
  87. </IKTextButton>
  88. <IKTextButton name="tbCustomerNo1" >
  89. <Events>
  90. <Click>
  91. <![CDATA[
  92. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  93. if( @temp == "" )
  94. return;
  95. tbCustomerNo1.CValue = @temp;
  96. ]]>
  97. </Click>
  98. <TextBoxButtonTextChanged>
  99. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  100. </TextBoxButtonTextChanged>
  101. </Events>
  102. </IKTextButton>
  103. <IKTextButton name="tbCustomerNo2" >
  104. <Events>
  105. <Click>
  106. <![CDATA[
  107. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  108. if( @temp == "" )
  109. return;
  110. tbCustomerNo2.CValue = @temp;
  111. ]]>
  112. </Click>
  113. </Events>
  114. </IKTextButton>
  115. <IKComboBoxEx name="cbPrincipal1" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  116. <Events>
  117. <Reload>
  118. UpdateForm(false, "cbPrincipal1");
  119. Search("SearchPrincipal");
  120. UpdateForm(true, "cbPrincipal1");
  121. </Reload>
  122. <TextChanged>
  123. cbPrincipal2.SelectedName = cbPrincipal1.SelectedName;
  124. cbPrincipal2.SelectedNo=cbPrincipal1.SelectedNo;
  125. </TextChanged>
  126. </Events>
  127. </IKComboBoxEx>
  128. <IKComboBoxEx name="cbPrincipal2" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee" >
  129. <Events>
  130. <Reload>
  131. UpdateForm(false, "cbPrincipal2");
  132. Search("SearchPrincipal");
  133. UpdateForm(true, "cbPrincipal2");
  134. </Reload>
  135. </Events>
  136. </IKComboBoxEx>
  137. <IKComboBoxEx name="cbLocation1" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
  138. <Events>
  139. <Reload>
  140. UpdateForm(false, "cbLocation1");
  141. Search("SearchLocation");
  142. UpdateForm(true, "cbLocation1");
  143. </Reload>
  144. <TextChanged>
  145. cbLocation2.SelectedName = cbLocation1.SelectedName;
  146. cbLocation2.SelectedNo = cbLocation1.SelectedNo;
  147. </TextChanged>
  148. </Events>
  149. </IKComboBoxEx>
  150. <IKComboBoxEx name="cbLocation2" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
  151. <Events>
  152. <Reload>
  153. UpdateForm(false, "cbLocation2");
  154. Search("SearchLocation");
  155. UpdateForm(true, "cbLocation2");
  156. </Reload>
  157. </Events>
  158. </IKComboBoxEx>
  159. <IKTextButton name="tbProduct1" >
  160. <Events>
  161. <Click>
  162. <![CDATA[
  163. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
  164. if( @temp == "" )
  165. return;
  166. tbProduct1.CValue = @temp;
  167. ]]>
  168. </Click>
  169. <TextBoxButtonTextChanged>
  170. tbProduct2.CValue = tbProduct1.CValue;
  171. </TextBoxButtonTextChanged>
  172. </Events>
  173. </IKTextButton>
  174. <IKTextButton name="tbProduct2" >
  175. <Events>
  176. <Click>
  177. <![CDATA[
  178. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
  179. if( @temp == "" )
  180. return;
  181. tbProduct2.CValue = @temp;
  182. ]]>
  183. </Click>
  184. </Events>
  185. </IKTextButton>
  186. <IKComboBoxEx name="cbType1" DataSource="Type" DisplayMember="Type_Product" >
  187. <Events>
  188. <Reload>
  189. UpdateForm(false, "cbType1");
  190. Search("SearchType");
  191. UpdateForm(true, "cbType1");
  192. </Reload>
  193. <TextChanged>
  194. cbType2.Text = cbType1.Text;
  195. </TextChanged>
  196. </Events>
  197. </IKComboBoxEx>
  198. <IKComboBoxEx name="cbType2" DataSource="Type" DisplayMember="Type_Product" >
  199. <Events>
  200. <Reload>
  201. UpdateForm(false, "cbType2");
  202. Search("SearchType");
  203. UpdateForm(true, "cbType2");
  204. </Reload>
  205. </Events>
  206. </IKComboBoxEx>
  207. <IKButton name="btnView">
  208. <Events>
  209. <Click>
  210. @ClickType="View";
  211. <Lable name="Action"/>
  212. </Click>
  213. </Events>
  214. </IKButton>
  215. <IKButton name="btnExcel">
  216. <Events>
  217. <Click>
  218. @ClickType="Excel";
  219. <Lable name="Action"/>
  220. </Click>
  221. </Events>
  222. </IKButton>
  223. <IKButton name="btnWord">
  224. <Events>
  225. <Click>
  226. @ClickType="Word";
  227. <Lable name="Action"/>
  228. </Click>
  229. </Events>
  230. </IKButton>
  231. <IKButton name="btnPrint">
  232. <Events>
  233. <Click>
  234. @ClickType="PrintToPrinter";
  235. <Lable name="Action"/>
  236. </Click>
  237. </Events>
  238. </IKButton>
  239. </Controls>
  240. <ChildForms>
  241. <ChildForm name="BillSearch" DataSource="SaleRtnBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="">
  242. <DataColumn Index="0" MappingName="#SaleRtnBill.No_SaleRtnBill" HeaderText="退货单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  243. <DataColumn Index="1" MappingName="#SaleRtnBill.Date_SaleRtnBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  244. <DataColumn Index="2" MappingName="#SaleRtnBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  245. <DataColumn Index="3" MappingName="#SaleRtnBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  246. </ChildForm>
  247. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  248. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  249. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  250. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  251. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  252. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  253. </ChildForm>
  254. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  255. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  256. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  257. </ChildForm>
  258. </ChildForms>
  259. <FormatString>
  260. <Format name="SearchCustomerCondition">
  261. if(GetRight("客户基本资料","全权查看"))
  262. {
  263. FormatString("");
  264. }
  265. else
  266. {
  267. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  268. }
  269. </Format>
  270. <Format name="SearchBillCondition">
  271. if(GetRight("客户基本资料","全权查看"))
  272. {
  273. FormatString("");
  274. }
  275. else
  276. {
  277. FormatString(" Disable_SaleRtnBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  278. }
  279. </Format>
  280. </FormatString>
  281. </Client>
  282. <Server>
  283. <Tables>
  284. <Table name="SaleRtnBill" Type="Parent">
  285. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleRtnBill.* FROM SaleRtnBill"/>
  286. </Table>
  287. <Table name="Get" Type="Other">
  288. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 convert(datetime,0) as StartDate ,
  289. convert(datetime,0) as EndDate ,
  290. convert(nvarchar(64),'') as StartNo_SaleRtnBill ,
  291. convert(nvarchar(64),'') as EndNo_SaleRtnBill ,
  292. convert(nvarchar(64),'') as StartNo_Customer ,
  293. convert(nvarchar(64),'') as EndNo_Customer ,
  294. convert(nvarchar(64),'') as StartNo_Principal ,
  295. convert(nvarchar(64),'') as EndNo_Principal ,
  296. convert(nvarchar(64),'') as StartNo_Location ,
  297. convert(nvarchar(64),'') as EndNo_Location ,
  298. convert(nvarchar(64),'') as StartNo_Product,
  299. convert(nvarchar(64),'') as EndNo_Product ,
  300. convert(nvarchar(64),'') as StartType_Product ,
  301. convert(nvarchar(64),'') as EndType_Product,
  302. convert(nvarchar(64),'') as Company ,
  303. convert(nvarchar(64),'') as Name_Create,
  304. convert(bit,0) as Combine
  305. "/>
  306. </Table>
  307. <Table name="FrmSalesStatisticsLocation" Type="Other">
  308. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Location, CONVERT(NVARCHAR(64),'') AS Name_Location,CONVERT(NVARCHAR(64),'') AS Currency_SaleRtnBill,
  309. CONVERT(DECIMAL,0.00) AS Quantity,
  310. CONVERT(DECIMAL,0.00) AS MoneySum,
  311. CONVERT(DECIMAL,0.00) AS Amount,
  312. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  313. "/>
  314. </Table>
  315. <Table name="FrmSalesStatisticsProduct" Type="Other">
  316. <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,
  317. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleRtnBill,
  318. CONVERT(DECIMAL,0.00) AS Price_Product,
  319. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  320. CONVERT(DECIMAL,0.00) AS Quantity,
  321. CONVERT(DECIMAL,0.00) AS MoneySum,
  322. CONVERT(DECIMAL,0.00) AS Amount,
  323. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  324. "/>
  325. </Table>
  326. <Table name="FrmSalesStatisticsPrincipal" Type="Other">
  327. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Employee, CONVERT(NVARCHAR(64),'') AS Principal_SaleRtnBill,CONVERT(NVARCHAR(64),'') AS Currency_SaleRtnBill,
  328. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleRtnBill,
  329. CONVERT(DECIMAL,0.00) AS TaxAmount,
  330. CONVERT(DECIMAL,0.00) AS Quantity,
  331. CONVERT(DECIMAL,0.00) AS MoneySum,
  332. CONVERT(DECIMAL,0.00) AS Amount,
  333. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  334. "/>
  335. </Table>
  336. <!--<Table name="FrmSalesStatisticsCustomer" Type="Other">
  337. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Customer, CONVERT(NVARCHAR(64),'') AS ShortName_Customer,CONVERT(NVARCHAR(64),'') AS Principal_SaleRtnBill,
  338. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleRtnBill,
  339. CONVERT(NVARCHAR(64),'') AS Currency_SaleRtnBill,
  340. CONVERT(DECIMAL,0.00) AS TaxAmount,
  341. CONVERT(DECIMAL,0.00) AS Quantity,
  342. CONVERT(DECIMAL,0.00) AS MoneySum,
  343. CONVERT(DECIMAL,0.00) AS Amount,
  344. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  345. "/>
  346. </Table>-->
  347. </Tables>
  348. <Search>
  349. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleRtnBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  350. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  351. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  352. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  353. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal ,Employee.Name_Employee as Principal_SaleRtnBill
  354. FROM SaleRtnBill
  355. LEFT JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
  356. LEFT JOIN AppUser a ON a.ID_User = SaleRtnBill.ID_Creator
  357. LEFT JOIN AppUser b ON b.ID_User = SaleRtnBill.ID_Assessor
  358. LEFT JOIN AppUser c ON c.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
  359. LEFT JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
  360. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal">
  361. <Tables>
  362. <Table name="AllBill" />
  363. </Tables>
  364. </SearchAllBill>
  365. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  366. <Tables>
  367. <Table name="AllCustomer" />
  368. </Tables>
  369. </SearchAllCustomer>
  370. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  371. <Tables>
  372. <Table name="AllProduct" />
  373. </Tables>
  374. </SearchAllProduct>
  375. <SearchPrincipal CmdType="Text" CmdText="SELECT DISTINCT No_Employee,Name_Employee
  376. FROM Employee
  377. ORDER BY No_Employee
  378. ">
  379. <Tables>
  380. <Table name="Principal" />
  381. </Tables>
  382. </SearchPrincipal>
  383. <SearchLocation CmdType="Text" CmdText=" SELECT Location.No_Location, Location.Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY Location.No_Location">
  384. <Tables>
  385. <Table name="Location" />
  386. </Tables>
  387. </SearchLocation>
  388. <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
  389. <Tables>
  390. <Table name="Type"/>
  391. </Tables>
  392. </SearchType>
  393. <SearchFrmSaleRtnStatisticsLocation CmdType="Text" CmdText=" CREATE TABLE Get
  394. (StartDate DATETIME,
  395. EndDate DATETIME,
  396. StartNo_SaleBill nvarchar(64),
  397. EndNo_SaleBill nvarchar(64),
  398. StartNo_Customer nvarchar(64),
  399. EndNo_Customer nvarchar(64),
  400. StartNo_Principal nvarchar(64),
  401. EndNo_Principal nvarchar(64),
  402. StartNo_Location nvarchar(64),
  403. EndNo_Location nvarchar(64),
  404. StartNo_Product nvarchar(64),
  405. EndNo_Product nvarchar(64),
  406. StartType_Product nvarchar(64),
  407. EndType_Product nvarchar(64),
  408. Company nvarchar(64),
  409. Name_Create nvarchar(64),
  410. Combine bit
  411. )
  412. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  413. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  414. StartNo_Location,EndNo_Location,Company,Name_Create,
  415. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine)
  416. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleRtnBill,''),isnull(@EndNo_SaleRtnBill,''),
  417. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  418. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  419. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine)
  420. SELECT * FROM Get
  421. DROP TABLE Get
  422. declare @CessOut decimal(14,4)
  423. Select @CessOut=CessOut_SystemSetting/100 From SystemSetting
  424. Select Product.No_Product,Product.Name_Product,Product.Unit_Product,Location.Name_Location,ab.Quantity,ab.Currency,ab.UnitPrice,
  425. ab.MoneySum,ab.Amount,ab.TaxCurrency,ab.Amount As CurrencyAmount,ab.No
  426. From
  427. (
  428. (
  429. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleRtnBill As Date,Type='S',
  430. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  431. UnitPrice_SaleRtnBillProduct As UnitPrice,Quantity_SaleRtnBillProduct As Quantity,
  432. MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
  433. 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)))
  434. else Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  435. Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  436. When '外加' Then (Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut))
  437. else Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end
  438. From SaleRtnBillProduct
  439. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  440. Where SaleRtnBill.ID_Assessor Is Not Null AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill)
  441. )
  442. )ab
  443. LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  444. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  445. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  446. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  447. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  448. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  449. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  450. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  451. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  452. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  453. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  454. Order By No_Location,No_Product,Type desc,No
  455. ">
  456. <Params>
  457. <Param name="@StartDate" type="SaleRtnBill.Date_SaleRtnBill" Index="0" />
  458. <Param name="@EndDate" type="SaleRtnBill.Date_SaleRtnBill" Index="1" />
  459. <Param name="@StartNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="2" />
  460. <Param name="@EndNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="3" />
  461. <Param name="@StartNo_Customer" type="SaleRtnBill.No_Customer" Index="4" />
  462. <Param name="@EndNo_Customer" type="SaleRtnBill.No_Customer" Index="5" />
  463. <Param name="@StartNo_Principal" type="SaleRtnBill.No_Customer" Index="6" />
  464. <Param name="@EndNo_Principal" type="SaleRtnBill.No_Customer" Index="7" />
  465. <Param name="@StartNo_Location" type="SaleRtnBill.No_Location" Index="8" />
  466. <Param name="@EndNo_Location" type="SaleRtnBill.No_Location" Index="9" />
  467. <Param name="@StartNo_Product" type="SaleRtnBill.No_Product" Index="10" />
  468. <Param name="@EndNo_Product" type="SaleRtnBill.No_Product" Index="11" />
  469. <Param name="@StartType_Product" type="SaleRtnBill.Type_Product" Index="12" />
  470. <Param name="@EndType_Product" type="SaleRtnBill.Type_Product" Index="13" />
  471. <Param name="@Company" type="SaleRtnBill.Type_Product" Index="14" />
  472. <Param name="@Name_Create" type="SaleRtnBill.Name_Location" Index="15" />
  473. <Param name="@Right" type="SaleRtnBill.ID_Customer" Index="16" />
  474. <Param name="@Combine" type="SaleRtnBill.Disable_SaleRtnBill" Index="17" />
  475. </Params>
  476. <Tables>
  477. <Table name="Get" />
  478. <Table name="FrmSalesStatisticsLocation"/>
  479. </Tables>
  480. </SearchFrmSaleRtnStatisticsLocation>
  481. <SearchFrmSaleRtnStatisticsCustomer CmdType="Text" CmdText=" CREATE TABLE Get
  482. (StartDate DATETIME,
  483. EndDate DATETIME,
  484. StartNo_SaleBill nvarchar(64),
  485. EndNo_SaleBill nvarchar(64),
  486. StartNo_Customer nvarchar(64),
  487. EndNo_Customer nvarchar(64),
  488. StartNo_Principal nvarchar(64),
  489. EndNo_Principal nvarchar(64),
  490. StartNo_Location nvarchar(64),
  491. EndNo_Location nvarchar(64),
  492. StartNo_Product nvarchar(64),
  493. EndNo_Product nvarchar(64),
  494. StartType_Product nvarchar(64),
  495. EndType_Product nvarchar(64),
  496. Company nvarchar(64),
  497. Name_Create nvarchar(64),
  498. Combine bit
  499. )
  500. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  501. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  502. StartNo_Location,EndNo_Location,Company,Name_Create,
  503. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine)
  504. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleRtnBill,''),isnull(@EndNo_SaleRtnBill,''),
  505. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  506. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  507. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine)
  508. SELECT * FROM Get
  509. DROP TABLE Get
  510. declare @CessOut decimal(14,4)
  511. Select @CessOut=CessOut_SystemSetting/100 From SystemSetting
  512. Select No_Customer,ShortName_Customer,Product.No_Product,Product.Name_Product,ab.Quantity,ab.Currency,ab.UnitPrice,
  513. ab.MoneySum,ab.Amount,ab.TaxCurrency,ab.Amount As CurrencyAmount,ab.No,ab.Reason_SaleRtnBill,
  514. ab.Name_Principal,
  515. IsNull(ab.PName_SaleRtnBill,'') As PName_SaleRtnBill,
  516. ab.No_FromBill,
  517. ab.Comment_SaleRtnBill
  518. From
  519. (
  520. (
  521. Select ID_Product,ID_Customer,ID_Principal,ID_Location,Date_SaleRtnBill As Date,Reason_SaleRtnBill,
  522. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  523. UnitPrice_SaleRtnBillProduct As UnitPrice,Quantity_SaleRtnBillProduct As Quantity,
  524. MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
  525. 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)))
  526. else Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  527. Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  528. When '外加' Then (Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))+Convert(Decimal(18,2),Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))*@CessOut))
  529. else Convert(Decimal(18,2),(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  530. Name_Employee As Name_Principal,
  531. PName_SaleRtnBill,
  532. No_FromBill,
  533. Comment_SaleRtnBill
  534. From SaleRtnBillProduct
  535. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  536. Join Employee On Employee.ID_Employee = SaleRtnBill.ID_Principal
  537. Where SaleRtnBill.ID_Assessor Is Not Null AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill)
  538. )
  539. )ab
  540. LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  541. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  542. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  543. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  544. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  545. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  546. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  547. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  548. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  549. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  550. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  551. Order By No_Customer,No
  552. ">
  553. <Params>
  554. <Param name="@StartDate" type="SaleRtnBill.Date_SaleRtnBill" Index="0" />
  555. <Param name="@EndDate" type="SaleRtnBill.Date_SaleRtnBill" Index="1" />
  556. <Param name="@StartNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="2" />
  557. <Param name="@EndNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="3" />
  558. <Param name="@StartNo_Customer" type="SaleRtnBill.No_Customer" Index="4" />
  559. <Param name="@EndNo_Customer" type="SaleRtnBill.No_Customer" Index="5" />
  560. <Param name="@StartNo_Principal" type="SaleRtnBill.No_Customer" Index="6" />
  561. <Param name="@EndNo_Principal" type="SaleRtnBill.No_Customer" Index="7" />
  562. <Param name="@StartNo_Location" type="SaleRtnBill.No_Location" Index="8" />
  563. <Param name="@EndNo_Location" type="SaleRtnBill.No_Location" Index="9" />
  564. <Param name="@StartNo_Product" type="SaleRtnBill.No_Product" Index="10" />
  565. <Param name="@EndNo_Product" type="SaleRtnBill.No_Product" Index="11" />
  566. <Param name="@StartType_Product" type="SaleRtnBill.Type_Product" Index="12" />
  567. <Param name="@EndType_Product" type="SaleRtnBill.Type_Product" Index="13" />
  568. <Param name="@Company" type="SaleRtnBill.Type_Product" Index="14" />
  569. <Param name="@Name_Create" type="SaleRtnBill.Name_Location" Index="15" />
  570. <Param name="@Right" type="SaleRtnBill.ID_Customer" Index="16" />
  571. <Param name="@Combine" type="SaleRtnBill.Disable_SaleRtnBill" Index="17" />
  572. </Params>
  573. <Tables>
  574. <Table name="Get" />
  575. <Table name="FrmSalesStatisticsCustomer"/>
  576. </Tables>
  577. </SearchFrmSaleRtnStatisticsCustomer>
  578. <SearchFrmSaleRtnStatisticsPrincipal CmdType="Text" CmdText="CREATE TABLE Get
  579. (StartDate DATETIME,
  580. EndDate DATETIME,
  581. StartNo_SaleBill nvarchar(64),
  582. EndNo_SaleBill nvarchar(64),
  583. StartNo_Customer nvarchar(64),
  584. EndNo_Customer nvarchar(64),
  585. StartNo_Principal nvarchar(64),
  586. EndNo_Principal nvarchar(64),
  587. StartNo_Location nvarchar(64),
  588. EndNo_Location nvarchar(64),
  589. StartNo_Product nvarchar(64),
  590. EndNo_Product nvarchar(64),
  591. StartType_Product nvarchar(64),
  592. EndType_Product nvarchar(64),
  593. Company nvarchar(64),
  594. Name_Create nvarchar(64),
  595. Combine bit
  596. )
  597. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  598. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  599. StartNo_Location,EndNo_Location,Company,Name_Create,
  600. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine)
  601. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleRtnBill,''),isnull(@EndNo_SaleRtnBill,''),
  602. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  603. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  604. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine)
  605. SELECT * FROM Get
  606. DROP TABLE Get
  607. Select Customer.No_Customer,Customer.ShortName_Customer,Name_Employee As Principal,No_Employee As No_Principal,Currency,TaxCurrency,No,Amount,GoodsAmount,TaxAmount,LocalAmount=Amount
  608. From
  609. (
  610. (
  611. Select ID_Customer,ID_Principal,Date_SaleRtnBill As Date,Type='S',ID_Location,
  612. Reason_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No='退'+No_SaleRtnBill,
  613. Amount_SaleRtnBill As Amount,GoodsAmount_SaleRtnBill As GoodsAmount,TaxAmount_SaleRtnBill As TaxAmount
  614. From SaleRtnBill
  615. Where SaleRtnBill.ID_Assessor Is Not Null AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill)
  616. )
  617. )ab
  618. --LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  619. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  620. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  621. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  622. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  623. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  624. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  625. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  626. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  627. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  628. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  629. Order By Principal,No_Customer,Type desc,No
  630. ">
  631. <Params>
  632. <Param name="@StartDate" type="SaleRtnBill.Date_SaleRtnBill" Index="0" />
  633. <Param name="@EndDate" type="SaleRtnBill.Date_SaleRtnBill" Index="1" />
  634. <Param name="@StartNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="2" />
  635. <Param name="@EndNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="3" />
  636. <Param name="@StartNo_Customer" type="SaleRtnBill.No_Customer" Index="4" />
  637. <Param name="@EndNo_Customer" type="SaleRtnBill.No_Customer" Index="5" />
  638. <Param name="@StartNo_Principal" type="SaleRtnBill.No_Customer" Index="6" />
  639. <Param name="@EndNo_Principal" type="SaleRtnBill.No_Customer" Index="7" />
  640. <Param name="@StartNo_Location" type="SaleRtnBill.No_Location" Index="8" />
  641. <Param name="@EndNo_Location" type="SaleRtnBill.No_Location" Index="9" />
  642. <Param name="@StartNo_Product" type="SaleRtnBill.No_Product" Index="10" />
  643. <Param name="@EndNo_Product" type="SaleRtnBill.No_Product" Index="11" />
  644. <Param name="@StartType_Product" type="SaleRtnBill.Type_Product" Index="12" />
  645. <Param name="@EndType_Product" type="SaleRtnBill.Type_Product" Index="13" />
  646. <Param name="@Company" type="SaleRtnBill.Type_Product" Index="14" />
  647. <Param name="@Name_Create" type="SaleRtnBill.Name_Location" Index="15" />
  648. <Param name="@Right" type="SaleRtnBill.ID_Customer" Index="16" />
  649. <Param name="@Combine" type="SaleRtnBill.Disable_SaleRtnBill" Index="17" />
  650. </Params>
  651. <Tables>
  652. <Table name="Get" />
  653. <Table name="FrmSalesStatisticsPrincipal"/>
  654. </Tables>
  655. </SearchFrmSaleRtnStatisticsPrincipal>
  656. <SearchFrmSaleRtnStatisticsReason CmdType="Text" CmdText=" CREATE TABLE Get
  657. (StartDate DATETIME,
  658. EndDate DATETIME,
  659. StartNo_SaleBill nvarchar(64),
  660. EndNo_SaleBill nvarchar(64),
  661. StartNo_Customer nvarchar(64),
  662. EndNo_Customer nvarchar(64),
  663. StartNo_Principal nvarchar(64),
  664. EndNo_Principal nvarchar(64),
  665. StartNo_Location nvarchar(64),
  666. EndNo_Location nvarchar(64),
  667. StartNo_Product nvarchar(64),
  668. EndNo_Product nvarchar(64),
  669. StartType_Product nvarchar(64),
  670. EndType_Product nvarchar(64),
  671. Company nvarchar(64),
  672. Name_Create nvarchar(64),
  673. Combine bit
  674. )
  675. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  676. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  677. StartNo_Location,EndNo_Location,Company,Name_Create,
  678. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product,Combine)
  679. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleRtnBill,''),isnull(@EndNo_SaleRtnBill,''),
  680. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  681. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),@Company,@Name_Create,
  682. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''),@Combine)
  683. SELECT * FROM Get
  684. DROP TABLE Get
  685. Select TypeName,No,Date,Customer.ShortName_Customer,Name_Employee As Principal,Location.Name_Location,Currency,TaxCurrency,Amount,GoodsAmount,TaxAmount,LocalAmount=Amount
  686. From
  687. (
  688. (
  689. Select ID_Customer,ID_Principal,Date_SaleRtnBill As Date,ID_Location,Reason_SaleRtnBill As TypeName,
  690. Currency_SaleRtnBill As Currency,TaxCurrency_SaleRtnBill As TaxCurrency,No=No_SaleRtnBill,
  691. Amount_SaleRtnBill As Amount,GoodsAmount_SaleRtnBill As GoodsAmount,TaxAmount_SaleRtnBill As TaxAmount
  692. From SaleRtnBill
  693. Where SaleRtnBill.ID_Assessor Is Not Null AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleRtnBill,SaleRtnBill.No_SaleRtnBill)
  694. )
  695. )ab
  696. --LEFT JOIN Product ON Product.ID_Product = ab.ID_Product
  697. LEFT JOIN Location ON Location.ID_Location = ab.ID_Location
  698. LEFT JOIN Customer ON Customer.ID_Customer = ab.ID_Customer
  699. LEFT JOIN Employee ON Employee.ID_Employee = ab.ID_Principal
  700. Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  701. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  702. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  703. --AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  704. --AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  705. AND Date Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),Date) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),Date)
  706. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  707. Order By TypeName
  708. ">
  709. <Params>
  710. <Param name="@StartDate" type="SaleRtnBill.Date_SaleRtnBill" Index="0" />
  711. <Param name="@EndDate" type="SaleRtnBill.Date_SaleRtnBill" Index="1" />
  712. <Param name="@StartNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="2" />
  713. <Param name="@EndNo_SaleRtnBill" type="SaleRtnBill.No_SaleRtnBill" Index="3" />
  714. <Param name="@StartNo_Customer" type="SaleRtnBill.No_Customer" Index="4" />
  715. <Param name="@EndNo_Customer" type="SaleRtnBill.No_Customer" Index="5" />
  716. <Param name="@StartNo_Principal" type="SaleRtnBill.No_Customer" Index="6" />
  717. <Param name="@EndNo_Principal" type="SaleRtnBill.No_Customer" Index="7" />
  718. <Param name="@StartNo_Location" type="SaleRtnBill.No_Location" Index="8" />
  719. <Param name="@EndNo_Location" type="SaleRtnBill.No_Location" Index="9" />
  720. <Param name="@StartNo_Product" type="SaleRtnBill.No_Product" Index="10" />
  721. <Param name="@EndNo_Product" type="SaleRtnBill.No_Product" Index="11" />
  722. <Param name="@StartType_Product" type="SaleRtnBill.Type_Product" Index="12" />
  723. <Param name="@EndType_Product" type="SaleRtnBill.Type_Product" Index="13" />
  724. <Param name="@Company" type="SaleRtnBill.Type_Product" Index="14" />
  725. <Param name="@Name_Create" type="SaleRtnBill.Name_Location" Index="15" />
  726. <Param name="@Right" type="SaleRtnBill.ID_Customer" Index="16" />
  727. <Param name="@Combine" type="SaleRtnBill.Disable_SaleRtnBill" Index="17" />
  728. </Params>
  729. <Tables>
  730. <Table name="Get" />
  731. <Table name="FrmSalesStatisticsBillType"/>
  732. </Tables>
  733. </SearchFrmSaleRtnStatisticsReason>
  734. </Search>
  735. </Server>
  736. <Lables>
  737. <Search>
  738. </Search>
  739. <Action>
  740. <![CDATA[
  741. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false &&ikRadioButton5.Checked==false)
  742. {
  743. MessageBox("请选择格式!",@Title);
  744. return;
  745. }
  746. Empty();
  747. @Company=GetCurrentCompanyNo();
  748. @Name_Create = GetCurrentUser();
  749. @StartDate = DBNull();
  750. @EndDate = DBNull();
  751. @StartNo_SaleRtnBill = DBNull();
  752. @EndNo_SaleRtnBill = DBNull();
  753. @StartNo_Customer = DBNull();
  754. @EndNo_Customer = DBNull();
  755. @StartNo_Principal = DBNull();
  756. @EndNo_Principal = DBNull();
  757. @StartNo_Location = DBNull();
  758. @EndNo_Location = DBNull();
  759. @StartNo_Product = DBNull();
  760. @EndNo_Product = DBNull();
  761. @StartType_Product = DBNull();
  762. @EndType_Product = DBNull();
  763. if(dtStart.Checked==true)
  764. @StartDate = dtStart.CValue;
  765. if(dtEnd.Checked==true)
  766. @EndDate = dtEnd.CValue;
  767. if(tbSaleRtnBillNo1.CValue != "")
  768. {@StartNo_SaleRtnBill = tbSaleRtnBillNo1.CValue;
  769. }
  770. if(tbSaleRtnBillNo2.CValue != "")
  771. {@EndNo_SaleRtnBill = tbSaleRtnBillNo2.CValue;
  772. }
  773. if(tbCustomerNo1.CValue != "")
  774. {@StartNo_Customer = tbCustomerNo1.CValue;
  775. }
  776. if(tbCustomerNo2.CValue != "")
  777. {@EndNo_Customer = tbCustomerNo2.CValue;
  778. }
  779. if(cbPrincipal1.Text!="")
  780. {
  781. if(!cbPrincipal1.CheckSelectedItem())
  782. {
  783. MessageBox("请选择有效的业务负责人!",@Title);
  784. cbPrincipal1.Focus();
  785. return;
  786. }
  787. else
  788. {
  789. @StartNo_Principal = cbPrincipal1.SelectedNo;
  790. }
  791. }
  792. if(cbPrincipal2.Text!="")
  793. {
  794. if(!cbPrincipal2.CheckSelectedItem())
  795. {
  796. MessageBox("请选择有效的业务负责人!",@Title);
  797. cbPrincipal2.Focus();
  798. return;
  799. }
  800. else
  801. {
  802. @EndNo_Principal = cbPrincipal2.SelectedNo;
  803. }
  804. }
  805. if(cbLocation1.Text!="")
  806. {
  807. if(!cbLocation1.CheckSelectedItem())
  808. {
  809. MessageBox("请选择有效的仓库!",@Title);
  810. cbLocation1.Focus();
  811. return;
  812. }
  813. else
  814. {
  815. @StartNo_Location = cbLocation1.SelectedNo;
  816. }
  817. }
  818. if(cbLocation2.Text!="")
  819. {
  820. if(!cbLocation2.CheckSelectedItem())
  821. {
  822. MessageBox("请选择有效的仓库!",@Title);
  823. cbLocation2.Focus();
  824. return;
  825. }
  826. else
  827. {
  828. @EndNo_Location = cbLocation2.SelectedNo;
  829. }
  830. }
  831. if(tbProduct1.CValue != "")
  832. @StartNo_Product = tbProduct1.CValue;
  833. if(tbProduct2.CValue != "")
  834. @EndNo_Product = tbProduct2.CValue;
  835. if(cbType1.Text != "")
  836. @StartType_Product = cbType1.Text;
  837. if(cbType2.Text != "")
  838. @EndType_Product = cbType2.Text;
  839. if(ikRadioButton4.Checked)
  840. {
  841. Search("SearchFrmSaleRtnStatisticsLocation",@StartDate,@EndDate,@StartNo_SaleRtnBill,@EndNo_SaleRtnBill,@StartNo_Customer,
  842. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  843. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked);
  844. if(RowCount("#FrmSalesStatisticsLocation")==0)
  845. {
  846. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  847. }
  848. else
  849. {
  850. switch(@ClickType)
  851. {
  852. case "View":
  853. PrintReport("GetFrmSaleRtnStatisticsLocation","Get","FrmSalesStatisticsLocation");
  854. break;
  855. default:
  856. ExportReport(@ClickType,"GetFrmSaleRtnStatisticsLocation","Get","FrmSalesStatisticsLocation");
  857. break;
  858. }
  859. }
  860. }
  861. if(ikRadioButton2.Checked)
  862. {
  863. Search("SearchFrmSaleRtnStatisticsReason",@StartDate,@EndDate,@StartNo_SaleRtnBill, @EndNo_SaleRtnBill,@StartNo_Customer,
  864. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  865. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked);
  866. if(RowCount("#FrmSalesStatisticsBillType") ==0)
  867. {
  868. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  869. }
  870. else
  871. {
  872. switch(@ClickType)
  873. {
  874. case "View":
  875. PrintReport("GetFrmSaleRtnStatisticsReason","Get","FrmSalesStatisticsBillType");
  876. break;
  877. default:
  878. ExportReport(@ClickType,"GetFrmSaleRtnStatisticsReason","Get","FrmSalesStatisticsBillType");
  879. break;
  880. }
  881. }
  882. }
  883. if(ikRadioButton1.Checked)
  884. {
  885. Search("SearchFrmSaleRtnStatisticsPrincipal",@StartDate,@EndDate,@StartNo_SaleRtnBill, @EndNo_SaleRtnBill,@StartNo_Customer,
  886. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  887. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked);
  888. if(RowCount("#FrmSalesStatisticsPrincipal") ==0)
  889. {
  890. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  891. }
  892. else
  893. {
  894. switch(@ClickType)
  895. {
  896. case "View":
  897. PrintReport("GetFrmSaleRtnStatisticsPrincipal","Get","FrmSalesStatisticsPrincipal");
  898. break;
  899. default:
  900. ExportReport(@ClickType,"GetFrmSaleRtnStatisticsPrincipal","Get","FrmSalesStatisticsPrincipal");
  901. break;
  902. }
  903. }
  904. }
  905. if(ikRadioButton3.Checked)
  906. {
  907. Search("SearchFrmSaleRtnStatisticsCustomer",@StartDate,@EndDate,@StartNo_SaleRtnBill, @EndNo_SaleRtnBill,@StartNo_Customer,
  908. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  909. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),ckCombine.Checked);
  910. if(RowCount("#FrmSalesStatisticsCustomer") ==0)
  911. {
  912. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  913. }
  914. else
  915. {
  916. switch(@ClickType)
  917. {
  918. case "View":
  919. PrintReport("GetFrmSaleRtnStatisticsCustomer","Get","FrmSalesStatisticsCustomer");
  920. break;
  921. default:
  922. ExportReport(@ClickType,"GetFrmSaleRtnStatisticsCustomer","Get","FrmSalesStatisticsCustomer");
  923. break;
  924. }
  925. }
  926. }
  927. ]]>
  928. </Action>
  929. <CheckChange>
  930. if(ikRadioButton4.Checked)
  931. {
  932. tbProduct1.ReadOnly=false;
  933. tbProduct2.ReadOnly=false;
  934. tbProduct1.IKButton.Enabled=true;
  935. tbProduct2.IKButton.Enabled=true;
  936. cbType1.Enabled=true;
  937. cbType2.Enabled=true;
  938. }
  939. else
  940. {
  941. tbProduct1.ReadOnly=true;
  942. tbProduct2.ReadOnly=true;
  943. tbProduct1.IKButton.Enabled=false;
  944. tbProduct2.IKButton.Enabled=false;
  945. cbType1.Enabled=false;
  946. cbType2.Enabled=false;
  947. }
  948. </CheckChange>
  949. </Lables>
  950. </Form>
  951. </Forms>