FrmSaleInvoiceStatistics.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmSaleInvoiceStatistics">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销售开票统计";
  9. GetSchema();
  10. txtCoNo.CValue=GetCurrentCompanyNo();
  11. txtCoName.CValue=GetCurrentCompanyShortName();
  12. Empty();
  13. NewInstance();
  14. #UI.StartDate_SaleBill = GetCurrentTime();
  15. #UI.EndDate_SaleBill = GetCurrentTime();
  16. ]]>
  17. </Load>
  18. <Closing>
  19. ;
  20. </Closing>
  21. <Closed>
  22. ;
  23. </Closed>
  24. </Events>
  25. <Mode>
  26. <Search>
  27. <Lable name="Search"/>
  28. </Search>
  29. </Mode>
  30. <Controls>
  31. <IKDateTimePicker name="dtStart" DataSource="UI.StartDate_SaleBill">
  32. <Events>
  33. <CheckedChanged>
  34. dtEnd.Checked = dtStart.Checked;
  35. </CheckedChanged>
  36. <ValueChanged>
  37. dtEnd.CValue = dtStart.CValue;
  38. </ValueChanged>
  39. </Events>
  40. </IKDateTimePicker>
  41. <IKDateTimePicker name="dtEnd" DataSource="UI.EndDate_SaleBill"/>
  42. <IKTextButton name="tbSaleBillNo1" DataSource="UI.StartNo_SaleBill">
  43. <Events>
  44. <Click>
  45. @temp=ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
  46. if(@temp=="")
  47. return;
  48. tbSaleBillNo1.CValue=@temp;
  49. </Click>
  50. <TextBoxButtonTextChanged>
  51. tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
  52. </TextBoxButtonTextChanged>
  53. </Events>
  54. </IKTextButton>
  55. <IKTextButton name="tbSaleBillNo2" DataSource="UI.EndNo_SaleBill" >
  56. <Events>
  57. <Click>
  58. @temp=ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
  59. if(@temp=="")
  60. return;
  61. tbSaleBillNo2.CValue=@temp;
  62. </Click>
  63. </Events>
  64. </IKTextButton>
  65. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  66. <Events>
  67. <Click>
  68. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  69. if( @temp == "" )
  70. return;
  71. tbCustomerNo1.CValue = @temp;
  72. </Click>
  73. <TextBoxButtonTextChanged>
  74. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  75. </TextBoxButtonTextChanged>
  76. </Events>
  77. </IKTextButton>
  78. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  79. <Events>
  80. <Click>
  81. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  82. if( @temp == "" )
  83. return;
  84. tbCustomerNo2.CValue = @temp;
  85. </Click>
  86. </Events>
  87. </IKTextButton>
  88. <IKTextButton name="tbProductNo1" DataSource="UI.StartNo_Product">
  89. <Events>
  90. <Click>
  91. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProductNo1.CValue);
  92. if( @temp == "" )
  93. return;
  94. tbProductNo1.CValue = @temp;
  95. </Click>
  96. <TextBoxButtonTextChanged>
  97. tbProductNo2.CValue = tbProductNo1.CValue;
  98. </TextBoxButtonTextChanged>
  99. </Events>
  100. </IKTextButton>
  101. <IKTextButton name="tbProductNo2" DataSource="UI.EndNo_Product">
  102. <Events>
  103. <Click>
  104. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProductNo2.CValue);
  105. if( @temp == "" )
  106. return;
  107. tbProductNo2.CValue = @temp;
  108. </Click>
  109. </Events>
  110. </IKTextButton>
  111. <IKTextButton name="tbInvoiceNo1" DataSource="UI.StartNo_Invoice">
  112. <Events>
  113. <Click>
  114. ShowSearchBox("SaleInvoiceBillSearch","NODEPOT", "tbInvoiceNo1",tbInvoiceNo1.CValue);
  115. </Click>
  116. <TextBoxButtonTextChanged>
  117. tbInvoiceNo2.CValue = tbInvoiceNo1.CValue;
  118. </TextBoxButtonTextChanged>
  119. </Events>
  120. </IKTextButton>
  121. <IKTextButton name="tbInvoiceNo2" DataSource="UI.EndNo_Invoice">
  122. <Events>
  123. <Click>
  124. ShowSearchBox("SaleInvoiceBillSearch","NODEPOT", "tbInvoiceNo2",tbInvoiceNo2.CValue);
  125. </Click>
  126. </Events>
  127. </IKTextButton>
  128. <IKButton name="btnView">
  129. <Events>
  130. <Click>
  131. UpdateForm(false,"");
  132. @StartDate_SaleBill=DBNull();
  133. @EndDate_SaleBill=DBNull();
  134. @StartNo_SaleBill = DBNull();
  135. @EndNo_SaleBill = DBNull();
  136. @StartNo_Customer = DBNull();
  137. @EndNo_Customer = DBNull();
  138. @StartNo_Product = DBNull();
  139. @EndNo_Product =DBNull();
  140. @StartNo_Invoice = DBNull();
  141. @EndNo_Invoice = DBNull();
  142. @IsRtn = 0;
  143. #UI.IsRtn = "N";
  144. if(dtStart.Checked)
  145. @StartDate_SaleBill=dtStart.Value;
  146. else
  147. #UI.StartDate_SaleBill=DBNull();
  148. if(dtEnd.Checked)
  149. @EndDate_SaleBill=dtEnd.Value;
  150. else
  151. #UI.EndDate_SaleBill=DBNull();
  152. if(tbSaleBillNo1.CValue != "")
  153. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  154. if(tbSaleBillNo2.CValue != "")
  155. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  156. if(tbCustomerNo1.CValue != "")
  157. @StartNo_Customer = tbCustomerNo1.CValue;
  158. if(tbCustomerNo2.CValue != "")
  159. @EndNo_Customer = tbCustomerNo2.CValue;
  160. if(tbProductNo1.CValue != "")
  161. @StartNo_Product = tbProduct1.CValue;
  162. if(tbProductNo2.CValue != "")
  163. @EndNo_Product = tbProduct2.CValue;
  164. if(tbInvoiceNo1.CValue != "")
  165. @StartNo_Invoice = tbInvoice1.CValue;
  166. if(tbInvoiceNo2.CValue != "")
  167. @EndNo_Invoice = tbInvoice2.CValue;
  168. if(ikRtnCheck.Checked)
  169. {
  170. @IsRtn = 1;
  171. #UI.IsRtn = "Y";
  172. }
  173. else
  174. {
  175. @IsRtn = 0;
  176. #UI.IsRtn = "N";
  177. }
  178. Search("SearchSaleInvoiceStatistics",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"),@IsRtn,@StartNo_Product,@EndNo_Product,@StartNo_Invoice,@EndNo_Invoice);
  179. if(RowCount("#FrmSaleInvoiceStatistics")==0)
  180. {
  181. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  182. }
  183. else
  184. {
  185. PrintReport("UIFrmSaleInvoiceStatistics","UI","FrmSaleInvoiceStatistics");
  186. }
  187. </Click>
  188. </Events>
  189. </IKButton>
  190. <IKButton name="btnExcel">
  191. <Events>
  192. <Click>
  193. UpdateForm(false,"");
  194. @StartDate_SaleBill=DBNull();
  195. @EndDate_SaleBill=DBNull();
  196. @StartNo_SaleBill = DBNull();
  197. @EndNo_SaleBill = DBNull();
  198. @StartNo_Customer = DBNull();
  199. @EndNo_Customer = DBNull();
  200. @IsRtn = 0;
  201. #UI.IsRtn = "N";
  202. if(dtStart.Checked)
  203. @StartDate_SaleBill=dtStart.Value;
  204. else
  205. #UI.StartDate_SaleBill=DBNull();
  206. if(dtEnd.Checked)
  207. @EndDate_SaleBill=dtEnd.Value;
  208. else
  209. #UI.EndDate_SaleBill=DBNull();
  210. if(tbSaleBillNo1.CValue != "")
  211. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  212. if(tbSaleBillNo2.CValue != "")
  213. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  214. if(tbCustomerNo1.CValue != "")
  215. @StartNo_Customer = tbCustomerNo1.CValue;
  216. if(tbCustomerNo2.CValue != "")
  217. @EndNo_Customer = tbCustomerNo2.CValue;
  218. if(tbProductNo1.CValue != "")
  219. @StartNo_Product = tbProduct1.CValue;
  220. if(tbProductNo2.CValue != "")
  221. @EndNo_Product = tbProduct2.CValue;
  222. if(tbInvoiceNo1.CValue != "")
  223. @StartNo_Invoice = tbInvoice1.CValue;
  224. if(tbInvoiceNo2.CValue != "")
  225. @EndNo_Invoice = tbInvoice2.CValue;
  226. if(ikRtnCheck.Checked)
  227. {
  228. @IsRtn = 1;
  229. #UI.IsRtn = "Y";
  230. }
  231. else
  232. {
  233. @IsRtn = 0;
  234. #UI.IsRtn = "N";
  235. }
  236. Search("SearchSaleInvoiceStatistics",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"),@IsRtn,@StartNo_Product,@EndNo_Product,@StartNo_Invoice,@EndNo_Invoice);
  237. if(RowCount("#FrmSaleInvoiceStatistics")==0)
  238. {
  239. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  240. }
  241. else
  242. {
  243. PrintReport("Excel","UIFrmSaleInvoiceStatistics","UI","FrmSaleInvoiceStatistics");
  244. }
  245. </Click>
  246. </Events>
  247. </IKButton>
  248. <IKButton name="btnWord">
  249. <Events>
  250. <Click>
  251. UpdateForm(false,"");
  252. @StartDate_SaleBill=DBNull();
  253. @EndDate_SaleBill=DBNull();
  254. @StartNo_SaleBill = DBNull();
  255. @EndNo_SaleBill = DBNull();
  256. @StartNo_Customer = DBNull();
  257. @EndNo_Customer = DBNull();
  258. @IsRtn = 0;
  259. #UI.IsRtn = "N";
  260. if(dtStart.Checked)
  261. @StartDate_SaleBill=dtStart.Value;
  262. else
  263. #UI.StartDate_SaleBill=DBNull();
  264. if(dtEnd.Checked)
  265. @EndDate_SaleBill=dtEnd.Value;
  266. else
  267. #UI.EndDate_SaleBill=DBNull();
  268. if(tbSaleBillNo1.CValue != "")
  269. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  270. if(tbSaleBillNo2.CValue != "")
  271. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  272. if(tbCustomerNo1.CValue != "")
  273. @StartNo_Customer = tbCustomerNo1.CValue;
  274. if(tbCustomerNo2.CValue != "")
  275. @EndNo_Customer = tbCustomerNo2.CValue;
  276. if(tbProductNo1.CValue != "")
  277. @StartNo_Product = tbProduct1.CValue;
  278. if(tbProductNo2.CValue != "")
  279. @EndNo_Product = tbProduct2.CValue;
  280. if(tbInvoiceNo1.CValue != "")
  281. @StartNo_Invoice = tbInvoice1.CValue;
  282. if(tbInvoiceNo2.CValue != "")
  283. @EndNo_Invoice = tbInvoice2.CValue;
  284. if(ikRtnCheck.Checked)
  285. {
  286. @IsRtn = 1;
  287. #UI.IsRtn = "Y";
  288. }
  289. else
  290. {
  291. @IsRtn = 0;
  292. #UI.IsRtn = "N";
  293. }
  294. Search("SearchSaleInvoiceStatistics",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"),@IsRtn,@StartNo_Product,@EndNo_Product,@StartNo_Invoice,@EndNo_Invoice);
  295. if(RowCount("#FrmSaleInvoiceStatistics")==0)
  296. {
  297. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  298. }
  299. else
  300. {
  301. PrintReport("Word","UIFrmSaleInvoiceStatistics","UI","FrmSaleInvoiceStatistics");
  302. }
  303. </Click>
  304. </Events>
  305. </IKButton>
  306. <IKButton name="btnPrint">
  307. <Events>
  308. <Click>
  309. UpdateForm(false,"");
  310. @StartDate_SaleBill=DBNull();
  311. @EndDate_SaleBill=DBNull();
  312. @StartNo_SaleBill = DBNull();
  313. @EndNo_SaleBill = DBNull();
  314. @StartNo_Customer = DBNull();
  315. @EndNo_Customer = DBNull();
  316. @IsRtn = 0;
  317. #UI.IsRtn = "N";
  318. if(dtStart.Checked)
  319. @StartDate_SaleBill=dtStart.Value;
  320. else
  321. #UI.StartDate_SaleBill=DBNull();
  322. if(dtEnd.Checked)
  323. @EndDate_SaleBill=dtEnd.Value;
  324. else
  325. #UI.EndDate_SaleBill=DBNull();
  326. if(tbSaleBillNo1.CValue != "")
  327. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  328. if(tbSaleBillNo2.CValue != "")
  329. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  330. if(tbCustomerNo1.CValue != "")
  331. @StartNo_Customer = tbCustomerNo1.CValue;
  332. if(tbCustomerNo2.CValue != "")
  333. @EndNo_Customer = tbCustomerNo2.CValue;
  334. if(tbProductNo1.CValue != "")
  335. @StartNo_Product = tbProduct1.CValue;
  336. if(tbProductNo2.CValue != "")
  337. @EndNo_Product = tbProduct2.CValue;
  338. if(tbInvoiceNo1.CValue != "")
  339. @StartNo_Invoice = tbInvoice1.CValue;
  340. if(tbInvoiceNo2.CValue != "")
  341. @EndNo_Invoice = tbInvoice2.CValue;
  342. if(ikRtnCheck.Checked)
  343. {
  344. @IsRtn = 1;
  345. #UI.IsRtn = "Y";
  346. }
  347. else
  348. {
  349. @IsRtn = 0;
  350. #UI.IsRtn = "N";
  351. }
  352. Search("SearchSaleInvoiceStatistics",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"),@IsRtn,@StartNo_Product,@EndNo_Product,@StartNo_Invoice,@EndNo_Invoice);
  353. if(RowCount("#FrmSaleInvoiceStatistics")==0)
  354. {
  355. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  356. }
  357. else
  358. {
  359. PrintReport("PrintToPrinter","UIFrmSaleInvoiceStatistics","UI","FrmSaleInvoiceStatistics");
  360. }
  361. </Click>
  362. </Events>
  363. </IKButton>
  364. </Controls>
  365. <ChildForms>
  366. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchSaleBillWithNo">
  367. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  368. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  369. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  370. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  371. <DataColumn Index="4" MappingName="#SaleBill.Name_Principal" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  372. <DataColumn Index="5" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  373. <DataColumn Index="5" MappingName="#SaleBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  374. <DataColumn Index="6" MappingName="#SaleBill.Tel_SaleBill" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  375. <DataColumn Index="7" MappingName="#SaleBill.Fax_SaleBill" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  376. </ChildForm>
  377. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  378. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  379. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  380. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  381. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  382. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  383. </ChildForm>
  384. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  385. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  386. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  387. </ChildForm>
  388. <ChildForm name="SaleInvoiceBillSearch" DataSource="SaleInvoice" SearchFunction="SearchAllSaleInvoiceBill" SearchFunctionByNo="" MappingName="发票">
  389. <DataColumn Index="0" MappingName="#SaleInvoice.No_Invoice" HeaderText="发票号码" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  390. <DataColumn Index="1" MappingName="#SaleInvoice.No_SaleInvoice" HeaderText="销项发票单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  391. </ChildForm>
  392. </ChildForms>
  393. <FormatString>
  394. <Format name="SearchCustomerCondition">
  395. if(GetRight("客户基本资料","全权查看"))
  396. {
  397. FormatString("");
  398. }
  399. else
  400. {
  401. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  402. }
  403. </Format>
  404. <Format name="SearchBillCondition">
  405. if(GetRight("客户基本资料","全权查看"))
  406. {
  407. FormatString("");
  408. }
  409. else
  410. {
  411. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  412. }
  413. </Format>
  414. </FormatString>
  415. </Client>
  416. <Server>
  417. <Tables>
  418. <Table name="UI" Type="Parent">
  419. <GetSchema CmdType="Text" CmdText="
  420. SELECT TOP 0 convert(datetime,0) As StartDate_SaleBill
  421. ,convert(datetime,0) As EndDate_SaleBill
  422. ,convert(nvarchar(64),'') As StartNo_SaleBill
  423. ,convert(nvarchar(64),'') As EndNo_SaleBill
  424. ,convert(nvarchar(64),'') As StartNo_Customer
  425. ,convert(nvarchar(64),'') As EndNo_Customer
  426. ,convert(nvarchar(64),'') As IsRtn
  427. ,convert(nvarchar(64),'') As StartNo_Product
  428. ,convert(nvarchar(64),'') As EndNo_Product
  429. ,convert(nvarchar(64),'') As StartNo_Invoice
  430. ,convert(nvarchar(64),'') As EndNo_Invoice
  431. "/>
  432. </Table>
  433. </Tables>
  434. <Search>
  435. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  436. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  437. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  438. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  439. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
  440. FROM SaleBill
  441. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  442. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  443. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  444. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  445. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  446. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  447. ">
  448. <Tables>
  449. <Table name="AllBill" />
  450. </Tables>
  451. </SearchAllBill>
  452. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  453. <Tables>
  454. <Table name="AllCustomer" />
  455. </Tables>
  456. </SearchAllCustomer>
  457. <SearchAllProduct CmdType="Text" CmdText="Select No_Product, Name_Product From Product">
  458. <Tables>
  459. <Table name="AllProduct" />
  460. </Tables>
  461. </SearchAllProduct>
  462. <SearchAllSaleInvoiceBill CmdType="Text" CmdText="Select * From SaleInvoice">
  463. <Tables>
  464. <Table name="AllSaleInvoiceBill" />
  465. </Tables>
  466. </SearchAllSaleInvoiceBill>
  467. <SearchSaleInvoiceStatistics CmdType="Text" CmdText="declare @sqlCmd nvarchar(4000)
  468. set @sqlCmd=N' Select SaleBillDetail.No_Customer'
  469. +N' , SaleBillDetail.ShortName_Customer As Name_Customer'
  470. +N' , No_SaleBill'
  471. +N' , Date_SaleBill As CreateDate_SaleBill'
  472. +N' , No_Product'
  473. +N' , Name_Product'
  474. +N' , No_SaleInvoice'
  475. +N' , No_Invoice'
  476. +N' , IsNull(SaleInvoiceDetail.Quantity_SaleInvoiceProduct,0) As Quantity_SaleInvoiceProduct'
  477. +N' , IsNull(SaleInvoiceDetail.Money_SaleInvoiceProduct,0) As Money_SaleInvoiceProduct'
  478. if (@IsRtn = 1)
  479. begin
  480. set @sqlCmd=@sqlCmd+N' , (IsNull(SaleBillDetail.Quantity_SaleBillProduct,0) - IsNull(SaleRtnDetail.Quantity_SaleRtnBillProduct,0)) As Quantity_SaleBillProduct'
  481. +N' , (IsNull(SaleBillDetail.Momey_SaleBillProduct,0) - IsNull(SaleRtnDetail.Money_SaleRtnBillProduct,0)) As Momey_SaleBillProduct'
  482. end
  483. else
  484. begin
  485. set @sqlCmd=@sqlCmd+N' , IsNull(SaleBillDetail.Quantity_SaleBillProduct,0) As Quantity_SaleBillProduct'
  486. +N' , IsNull(SaleBillDetail.Momey_SaleBillProduct,0) As Momey_SaleBillProduct'
  487. end
  488. set @sqlCmd=@sqlCmd+N' From'
  489. +N' ('
  490. +N' Select No_SaleBill'
  491. +N' , ID_Product'
  492. +N' , No_SaleBillProduct'
  493. +N' , SaleDetail.Quantity_SaleBillProduct'
  494. +N' , SaleDetail.Momey_SaleBillProduct * (case TaxCurrency_SaleBill WHEN '+nchar(39)+'外加'+nchar(39)+ N' Then 1.17 else 1 end) AS Momey_SaleBillProduct'
  495. +N' , No_Customer'
  496. +N' , ShortName_Customer'
  497. +N' , Date_SaleBill'
  498. +N' From'
  499. +N' ('
  500. +N' Select ID_SaleBill'
  501. +N' , ID_Product'
  502. +N' , No_SaleBillProduct'
  503. +N' , Sum(Quantity_SaleBillProduct) As Quantity_SaleBillProduct'
  504. +N' , Sum(UnitPrice_SaleBillProduct * Quantity_SaleBillProduct) As Momey_SaleBillProduct'
  505. +N' From SaleBillProduct'
  506. +N' Group By ID_SaleBill, ID_Product ,No_SaleBillProduct'
  507. +N' ) SaleDetail '
  508. +N' Left Join SaleBill On SaleBill.ID_SaleBill = SaleDetail.ID_SaleBill'
  509. +N' Left Join Customer On Customer.ID_Customer = SaleBill.ID_Customer'
  510. +N' Where SaleBill.ID_Assessor Is Not Null '
  511. +N' ) SaleBillDetail'
  512. +N' Left Join'
  513. +N' ('
  514. +N' Select SaleInvoiceProduct.ID_SaleInvoice'
  515. +N' , No_FromBill'
  516. +N' , ID_Product'
  517. +N' , No_FromBillProduct'
  518. +N' , Sum(Quantity_SaleInvoiceProduct) As Quantity_SaleInvoiceProduct'
  519. +N' , Sum(Amount_SaleInvoiceProduct) * (case IncludeTax_SaleInvoice WHEN 0 Then 1.17 else 1 end) As Money_SaleInvoiceProduct'
  520. +N' From SaleInvoiceProduct'
  521. +N' Left Join SaleInvoice On SaleInvoice.ID_SaleInvoice = SaleInvoiceProduct.ID_SaleInvoice'
  522. +N' Where SaleInvoice.ID_Assessor Is Not Null'
  523. +N' And Type_FromBill = 21'
  524. +N' Group By SaleInvoiceProduct.ID_SaleInvoice, No_FromBill, ID_Product, IncludeTax_SaleInvoice, No_FromBillProduct'
  525. +N' ) SaleInvoiceDetail On SaleInvoiceDetail.No_FromBill = SaleBillDetail.No_SaleBill'
  526. +N' And SaleInvoiceDetail.ID_Product = SaleBillDetail.ID_Product'
  527. +N' And SaleInvoiceDetail.No_FromBillProduct = SaleBillDetail.No_SaleBillProduct'
  528. +N' Left Join SaleInvoice On SaleInvoice.ID_SaleInvoice = SaleInvoiceDetail.ID_SaleInvoice '
  529. +N' Left Join Product On Product.ID_Product = SaleBillDetail.ID_Product'
  530. if (@IsRtn = 1)
  531. begin
  532. set @sqlCmd=@sqlCmd+N' Left Join'
  533. +N' ('
  534. +N' Select No_FromBill'
  535. +N' , No_FromBillProduct'
  536. +N' , Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct'
  537. +N' , Sum((Quantity_SaleRtnBillProduct * UnitPrice_SaleRtnBillProduct)) * (case TaxCurrency_SaleRtnBill WHEN '+nchar(39)+'外加'+nchar(39)+ N' Then 1.17 else 1 end) As Money_SaleRtnBillProduct'
  538. +N' From SaleRtnBillProduct'
  539. +N' Left Join SaleRtnBill On SaleRtnBill.ID_SaleRtnBill = SaleRtnBillProduct.ID_SaleRtnBill'
  540. +N' Where SaleRtnBill.ID_Assessor Is Not Null'
  541. +N' Group By No_FromBill,No_FromBillProduct,TaxCurrency_SaleRtnBill'
  542. +N' ) SaleRtnDetail On SaleRtnDetail.No_FromBill = SaleBillDetail.No_SaleBill'
  543. +N' And SaleRtnDetail.No_FromBillProduct = SaleBillDetail.No_SaleBillProduct'
  544. end
  545. set @sqlCmd=@sqlCmd+N' Where No_SaleBill Is Not Null'
  546. if(@StartDate_SaleBill Is Not Null)
  547. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N',Date_SaleBill) &gt;=0 '
  548. if(@EndDate_SaleBill Is Not Null)
  549. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N',Date_SaleBill) &lt;=0 '
  550. if(@StartNo_SaleBill Is Not Null)
  551. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  552. if(@EndNo_SaleBill Is Not Null)
  553. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  554. if(@StartNo_Customer Is Not Null)
  555. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  556. if(@EndNo_Customer Is Not Null)
  557. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  558. if(@StartNo_Product Is Not Null)
  559. set @sqlCmd=@sqlCmd+N' And No_Product &gt;= '+nchar(39)+@StartNo_Product+nchar(39)
  560. if(@EndNo_Product Is Not Null)
  561. set @sqlCmd=@sqlCmd+N' And No_Product &lt;= '+nchar(39)+@EndNo_Product+nchar(39)
  562. if(@StartNo_Invoice Is Not Null)
  563. set @sqlCmd=@sqlCmd+N' And No_Invoice &gt;= '+nchar(39)+@StartNo_Invoice+nchar(39)
  564. if(@EndNo_Invoice Is Not Null)
  565. set @sqlCmd=@sqlCmd+N' And No_Invoice &lt;= '+nchar(39)+@EndNo_Invoice+nchar(39)
  566. if(@Right Is Not Null)
  567. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  568. if(@Special=0)
  569. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  570. set @sqlCmd=@sqlCmd+N' Order By No_Customer,Date_SaleBill'
  571. EXECUTE sp_executesql @sqlCmd">
  572. <Params>
  573. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  574. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  575. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  576. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  577. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  578. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  579. <Param name="@Right" type="SaleBill.ID_Customer" Index="6" />
  580. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="7" />
  581. <Param name="@IsRtn" type="SaleInvoice.Type_SaleInvoice" Index="8" />
  582. <Param name="@StartNo_Product" type="Product.No_Product" Index="9" />
  583. <Param name="@EndNo_Product" type="Product.No_Product" Index="10" />
  584. <Param name="@StartNo_Invoice" type="Invoice.No_Invoice" Index="11" />
  585. <Param name="@EndNo_Invoice" type="Invoice.No_Invoice" Index="12" />
  586. </Params>
  587. <Tables>
  588. <Table name="FrmSaleInvoiceStatistics"/>
  589. </Tables>
  590. </SearchSaleInvoiceStatistics>
  591. </Search>
  592. </Server>
  593. </Form>
  594. </Forms>