FrmCostList.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmCostList">
  4. <Client>
  5. <Events>
  6. <Load><![CDATA[
  7. @Title="销货成本明细";
  8. GetSchema();
  9. txtCoNo.CValue=GetCurrentCompanyNo();
  10. txtCoName.CValue=GetCurrentCompanyShortName();
  11. Empty();
  12. NewInstance();
  13. ]]></Load>
  14. <Closing>
  15. ;
  16. </Closing>
  17. <Closed>
  18. ;
  19. </Closed>
  20. </Events>
  21. <Mode>
  22. <Search>
  23. <Lable name="Search"/>
  24. </Search>
  25. </Mode>
  26. <Controls>
  27. <IKTextBox name="txtCoName" DataSource="UI.Company"/>
  28. <IKDateTimePicker name = "dtStart" DataSource="UI.StartDate">
  29. <Events>
  30. <CheckedChanged>
  31. dtEnd.Checked = dtStart.Checked;
  32. </CheckedChanged>
  33. <ValueChanged>
  34. dtEnd.CValue = dtStart.CValue;
  35. </ValueChanged>
  36. </Events>
  37. </IKDateTimePicker>
  38. <IKDateTimePicker name="dtEnd" DataSource="UI.EndDate"/>
  39. <IKTextButton name="tbSaleBillNo1" DataSource="UI.StartNo_SaleBill">
  40. <Events>
  41. <Click>
  42. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
  43. </Click>
  44. <TextBoxButtonTextChanged>
  45. tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
  46. </TextBoxButtonTextChanged>
  47. </Events>
  48. </IKTextButton>
  49. <IKTextButton name="tbSaleBillNo2" DataSource="UI.EndNo_SaleBill" >
  50. <Events>
  51. <Click>
  52. @temp=ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
  53. if(@temp=="")
  54. return;
  55. tbSaleBillNo2.CValue=@temp;
  56. </Click>
  57. </Events>
  58. </IKTextButton>
  59. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  60. <Events>
  61. <Click>
  62. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  63. if( @temp == "" )
  64. return;
  65. tbCustomerNo1.CValue = @temp;
  66. </Click>
  67. <TextBoxButtonTextChanged>
  68. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  69. </TextBoxButtonTextChanged>
  70. </Events>
  71. </IKTextButton>
  72. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  73. <Events>
  74. <Click>
  75. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  76. if( @temp == "" )
  77. return;
  78. tbCustomerNo2.CValue = @temp;
  79. </Click>
  80. </Events>
  81. </IKTextButton>
  82. <IKTextButton name="tbProduct1" DataSource="UI.StartNo_Product">
  83. <Events>
  84. <Click>
  85. <![CDATA[
  86. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
  87. if( @temp == "" )
  88. return;
  89. tbProduct1.CValue = @temp;
  90. ]]>
  91. </Click>
  92. <TextBoxButtonTextChanged>
  93. tbProduct2.CValue = tbProduct1.CValue;
  94. </TextBoxButtonTextChanged>
  95. </Events>
  96. </IKTextButton>
  97. <IKTextButton name="tbProduct2" DataSource="UI.EndNo_Product">
  98. <Events>
  99. <Click>
  100. <![CDATA[
  101. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
  102. if( @temp == "" )
  103. return;
  104. tbProduct2.CValue = @temp;
  105. ]]>
  106. </Click>
  107. </Events>
  108. </IKTextButton>
  109. <IKComboBoxEx name="cbType1" DisplaySource="UI.StartType_Product" DataSource="Type" DisplayMember="Type_Product" >
  110. <Events>
  111. <Reload>
  112. UpdateForm(false, "cbType1");
  113. Search("SearchType");
  114. UpdateForm(true, "cbType1");
  115. </Reload>
  116. <TextChanged>
  117. cbType2.Text = cbType1.Text;
  118. </TextChanged>
  119. </Events>
  120. </IKComboBoxEx>
  121. <IKComboBoxEx name="cbType2" DisplaySource="UI.EndType_Product" DataSource="Type" DisplayMember="Type_Product" >
  122. <Events>
  123. <Reload>
  124. UpdateForm(false, "cbType2");
  125. Search("SearchType");
  126. UpdateForm(true, "cbType2");
  127. </Reload>
  128. </Events>
  129. </IKComboBoxEx>
  130. <IKButton name="btnView">
  131. <Events>
  132. <Click>
  133. UpdateForm(false,"");
  134. #UI.Name_Creator = GetCurrentUser();
  135. #UI.CreatDate = GetCurrentTime();
  136. @StartDate = dtStart.Checked?dtStart.Value:DBNull();
  137. @EndDate = dtEnd.Checked?dtEnd.Value:DBNull();
  138. @StartNo_SaleBill = tbSaleBillNo1.CValue!=""?tbSaleBillNo1.CValue:DBNull();
  139. @EndNo_SaleBill =tbSaleBillNo2.CValue!=""?tbSaleBillNo2.CValue:DBNull();
  140. @StartNo_Customer =tbCustomerNo1.CValue!=""?tbCustomerNo1.CValue:DBNull();
  141. @EndNo_Customer =tbCustomerNo2.CValue!=""?tbCustomerNo2.CValue:DBNull();
  142. @StartNo_Product =tbProduct1.CValue!=""?tbProduct1.CValue:DBNull();
  143. @EndNo_Product = tbProduct2.CValue!=""?tbProduct2.CValue:DBNull();
  144. @StartType_Product = cbType1.Text!=""?cbType1.Text:DBNull();
  145. @EndType_Product = cbType2.Text!=""?cbType2.Text:DBNull();
  146. if(ikRadioButton2.Checked)
  147. {
  148. Search("SearchCostListByProduct",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  149. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  150. if(RowCount("#FrmCostListByProduct")==0)
  151. {
  152. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  153. }
  154. else
  155. {
  156. PrintReport("UIFrmCostListByProduct","UI","FrmCostListByProduct");
  157. }
  158. }
  159. else
  160. {
  161. Search("SearchCostListBySaleBill",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  162. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  163. if(RowCount("#FrmCostListBySaleBill")==0)
  164. {
  165. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  166. }
  167. else
  168. {
  169. PrintReport("UIFrmCostListBySaleBill","UI","FrmCostListBySaleBill");
  170. }
  171. }
  172. </Click>
  173. </Events>
  174. </IKButton>
  175. <IKButton name="btnExcel">
  176. <Events>
  177. <Click>
  178. UpdateForm(false,"");
  179. #UI.Name_Creator = GetCurrentUser();
  180. #UI.CreatDate = GetCurrentTime();
  181. @StartDate = dtStart.Checked?dtStart.Value:DBNull();
  182. @EndDate = dtEnd.Checked?dtEnd.Value:DBNull();
  183. @StartNo_SaleBill = tbSaleBillNo1.CValue!=""?tbSaleBillNo1.CValue:DBNull();
  184. @EndNo_SaleBill =tbSaleBillNo2.CValue!=""?tbSaleBillNo2.CValue:DBNull();
  185. @StartNo_Customer =tbCustomerNo1.CValue!=""?tbCustomerNo1.CValue:DBNull();
  186. @EndNo_Customer =tbCustomerNo2.CValue!=""?tbCustomerNo2.CValue:DBNull();
  187. @StartNo_Product =tbProduct1.CValue!=""?tbProduct1.CValue:DBNull();
  188. @EndNo_Product = tbProduct2.CValue!=""?tbProduct2.CValue:DBNull();
  189. @StartType_Product = cbType1.Text!=""?cbType1.Text:DBNull();
  190. @EndType_Product = cbType2.Text!=""?cbType2.Text:DBNull();
  191. if(ikRadioButton2.Checked)
  192. {
  193. Search("SearchCostListByProduct",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  194. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  195. if(RowCount("#FrmCostListByProduct")==0)
  196. {
  197. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  198. }
  199. else
  200. {
  201. ExportReport("Excel","UIFrmCostListByProduct","UI","FrmCostListByProduct");
  202. }
  203. }
  204. else
  205. {
  206. Search("SearchCostListBySaleBill",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  207. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  208. if(RowCount("#FrmCostListBySaleBill")==0)
  209. {
  210. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  211. }
  212. else
  213. {
  214. ExportReport("Excel","UIFrmCostListBySaleBill","UI","FrmCostListBySaleBill");
  215. }
  216. }
  217. </Click>
  218. </Events>
  219. </IKButton>
  220. <IKButton name="btnWord">
  221. <Events>
  222. <Click>
  223. UpdateForm(false,"");
  224. #UI.Name_Creator = GetCurrentUser();
  225. #UI.CreatDate = GetCurrentTime();
  226. @StartDate = dtStart.Checked?dtStart.Value:DBNull();
  227. @EndDate = dtEnd.Checked?dtEnd.Value:DBNull();
  228. @StartNo_SaleBill = tbSaleBillNo1.CValue!=""?tbSaleBillNo1.CValue:DBNull();
  229. @EndNo_SaleBill =tbSaleBillNo2.CValue!=""?tbSaleBillNo2.CValue:DBNull();
  230. @StartNo_Customer =tbCustomerNo1.CValue!=""?tbCustomerNo1.CValue:DBNull();
  231. @EndNo_Customer =tbCustomerNo2.CValue!=""?tbCustomerNo2.CValue:DBNull();
  232. @StartNo_Product =tbProduct1.CValue!=""?tbProduct1.CValue:DBNull();
  233. @EndNo_Product = tbProduct2.CValue!=""?tbProduct2.CValue:DBNull();
  234. @StartType_Product = cbType1.Text!=""?cbType1.Text:DBNull();
  235. @EndType_Product = cbType2.Text!=""?cbType2.Text:DBNull();
  236. if(ikRadioButton2.Checked)
  237. {
  238. Search("SearchCostListByProduct",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  239. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  240. if(RowCount("#FrmCostListByProduct")==0)
  241. {
  242. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  243. }
  244. else
  245. {
  246. ExportReport("Word","UIFrmCostListByProduct","UI","FrmCostListByProduct");
  247. }
  248. }
  249. else
  250. {
  251. Search("SearchCostListBySaleBill",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  252. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  253. if(RowCount("#FrmCostListBySaleBill")==0)
  254. {
  255. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  256. }
  257. else
  258. {
  259. ExportReport("Word","UIFrmCostListBySaleBill","UI","FrmCostListBySaleBill");
  260. }
  261. }
  262. </Click>
  263. </Events>
  264. </IKButton>
  265. <IKButton name="btnPrint">
  266. <Events>
  267. <Click>
  268. UpdateForm(false,"");
  269. #UI.Name_Creator = GetCurrentUser();
  270. #UI.CreatDate = GetCurrentTime();
  271. @StartDate = dtStart.Checked?dtStart.Value:DBNull();
  272. @EndDate = dtEnd.Checked?dtEnd.Value:DBNull();
  273. @StartNo_SaleBill = tbSaleBillNo1.CValue!=""?tbSaleBillNo1.CValue:DBNull();
  274. @EndNo_SaleBill =tbSaleBillNo2.CValue!=""?tbSaleBillNo2.CValue:DBNull();
  275. @StartNo_Customer =tbCustomerNo1.CValue!=""?tbCustomerNo1.CValue:DBNull();
  276. @EndNo_Customer =tbCustomerNo2.CValue!=""?tbCustomerNo2.CValue:DBNull();
  277. @StartNo_Product =tbProduct1.CValue!=""?tbProduct1.CValue:DBNull();
  278. @EndNo_Product = tbProduct2.CValue!=""?tbProduct2.CValue:DBNull();
  279. @StartType_Product = cbType1.Text!=""?cbType1.Text:DBNull();
  280. @EndType_Product = cbType2.Text!=""?cbType2.Text:DBNull();
  281. if(ikRadioButton2.Checked)
  282. {
  283. Search("SearchCostListByProduct",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  284. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  285. if(RowCount("#FrmCostListByProduct")==0)
  286. {
  287. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  288. }
  289. else
  290. {
  291. ExportReport("PrintToPrinter","UIFrmCostListByProduct","UI","FrmCostListByProduct");
  292. }
  293. }
  294. else
  295. {
  296. Search("SearchCostListBySaleBill",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,
  297. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  298. if(RowCount("#FrmCostListBySaleBill")==0)
  299. {
  300. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  301. }
  302. else
  303. {
  304. ExportReport("PrintToPrinter","UIFrmCostListBySaleBill","UI","FrmCostListBySaleBill");
  305. }
  306. }
  307. </Click>
  308. </Events>
  309. </IKButton>
  310. </Controls>
  311. <ChildForms>
  312. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="">
  313. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  314. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  315. <DataColumn Index="2" MappingName="#SaleBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  316. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  317. </ChildForm>
  318. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  319. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  320. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  321. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  322. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  323. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  324. </ChildForm>
  325. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  326. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  327. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  328. </ChildForm>
  329. </ChildForms>
  330. <FormatString>
  331. <Format name="SearchCustomerCondition">
  332. if(GetRight("客户基本资料","全权查看"))
  333. {
  334. FormatString("");
  335. }
  336. else
  337. {
  338. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  339. }
  340. </Format>
  341. <Format name="SearchBillCondition">
  342. if(GetRight("客户基本资料","全权查看"))
  343. {
  344. FormatString("");
  345. }
  346. else
  347. {
  348. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  349. }
  350. </Format>
  351. </FormatString>
  352. </Client>
  353. <Server>
  354. <Tables>
  355. <Table name="UI" Type="Parent">
  356. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 convert(datetime,0) as StartDate,
  357. convert(datetime,0) as EndDate ,
  358. convert(nvarchar(64),'') as StartNo_SaleBill ,
  359. convert(nvarchar(64),'') as EndNo_SaleBill ,
  360. convert(nvarchar(64),'') as StartNo_Customer ,
  361. convert(nvarchar(64),'') as EndNo_Customer ,
  362. convert(nvarchar(64),'') as StartNo_Product,
  363. convert(nvarchar(64),'') as EndNo_Product ,
  364. convert(nvarchar(64),'') as StartType_Product ,
  365. convert(nvarchar(64),'') as EndType_Product,
  366. convert(nvarchar(64),'') as Company ,
  367. convert(nvarchar(64),'') as Name_Creator,
  368. convert(datetime,0) As CreatDate "/>
  369. </Table>
  370. </Tables>
  371. <Search>
  372. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  373. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer, Customer.ID_Creator,
  374. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  375. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  376. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_SaleBill
  377. FROM SaleBill
  378. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  379. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  380. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  381. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  382. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  383. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal">
  384. <Tables>
  385. <Table name="AllBill" />
  386. </Tables>
  387. </SearchAllBill>
  388. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  389. <Tables>
  390. <Table name="AllCustomer" />
  391. </Tables>
  392. </SearchAllCustomer>
  393. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  394. <Tables>
  395. <Table name="AllProduct" />
  396. </Tables>
  397. </SearchAllProduct>
  398. <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
  399. <Tables>
  400. <Table name="Type"/>
  401. </Tables>
  402. </SearchType>
  403. <SearchCostListByProduct CmdType="Text" CmdText="
  404. Select Product.No_Product,Product.Name_Product,SaleBill.Date_SaleBill,SaleBill.No_SaleBill,SaleBillProduct.Quantity_SaleBillProduct,
  405. convert(nvarchar(64),SaleBillProduct.ID_SaleBillProduct) As ID_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct,Currency_SaleBill,Product.Unit_Product,a.No_SaleOutDepotBill,a.Quantity_SaleOutDepotBillProduct,a.UnitCost_SaleOutDepotBillProduct,a.Quantity_SaleOutDepotBillProduct*a.UnitCost_SaleOutDepotBillProduct As CostMoney
  406. From SaleBill
  407. Left Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
  408. Left Join Product On Product.ID_Product=SaleBillProduct.ID_Product
  409. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  410. Left Join
  411. ( Select SaleOutDepotBill.No_SaleOutDepotBill,Quantity_SaleOutDepotBillProduct,UnitCost_SaleOutDepotBillProduct,ID_SaleSourceBillProduct
  412. From SaleOutDepotBill
  413. Left Join SaleOutDepotBillProduct On SaleOutDepotBillProduct.ID_SaleOutDepotBill=SaleOutDepotBill.ID_SaleOutDepotBill
  414. Where SaleOutDepotBill.ID_Assessor Is Not Null
  415. )a On a.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
  416. Where SaleBill.ID_Assessor Is Not Null
  417. And SaleBill.Date_SaleBill BETWEEN ISNULL(DATEADD(day, DATEDIFF(day, 0, @StartDate), 0), '1900-1-1') AND ISNULL(DATEADD(day, DATEDIFF(day, 0, DATEADD(day, 1, @EndDate)), 0), '9999-12-31')
  418. And SaleBill.No_SaleBill Between IsNull(@StartNo_SaleBill,No_SaleBill) And IsNull(@EndNo_SaleBill,No_SaleBill)
  419. And No_Customer Between IsNull(@StartNo_Customer,No_Customer) And IsNull(@EndNo_Customer,No_Customer)
  420. And No_Product Between IsNull(@StartNo_Product,No_Product) And IsNull(@EndNo_Product,No_Product)
  421. And Type_Product Between IsNull(@StartType_Product,Type_Product) And IsNull(@EndType_Product,Type_Product)
  422. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  423. Order By No_Product,No_SaleBill,No_SaleOutDepotBill
  424. ">
  425. <Params>
  426. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  427. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  428. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  429. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  430. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  431. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  432. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  433. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  434. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  435. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  436. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  437. </Params>
  438. <Tables>
  439. <Table name="FrmCostListByProduct"/>
  440. </Tables>
  441. </SearchCostListByProduct>
  442. <SearchCostListBySaleBill CmdType="Text" CmdText="
  443. Select Product.No_Product,Product.Name_Product,SaleBill.Date_SaleBill,SaleBill.No_SaleBill,SaleBillProduct.Quantity_SaleBillProduct,
  444. convert(nvarchar(64),SaleBillProduct.ID_SaleBillProduct) As ID_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct,Currency_SaleBill,Product.Unit_Product,a.No_SaleOutDepotBill,a.Quantity_SaleOutDepotBillProduct,a.UnitCost_SaleOutDepotBillProduct,a.Quantity_SaleOutDepotBillProduct*a.UnitCost_SaleOutDepotBillProduct As CostMoney
  445. From SaleBill
  446. Left Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
  447. Left Join Product On Product.ID_Product=SaleBillProduct.ID_Product
  448. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  449. Left Join
  450. ( Select SaleOutDepotBill.No_SaleOutDepotBill,Quantity_SaleOutDepotBillProduct,UnitCost_SaleOutDepotBillProduct,ID_SaleSourceBillProduct
  451. From SaleOutDepotBill
  452. Left Join SaleOutDepotBillProduct On SaleOutDepotBillProduct.ID_SaleOutDepotBill=SaleOutDepotBill.ID_SaleOutDepotBill
  453. Where SaleOutDepotBill.ID_Assessor Is Not Null
  454. )a On a.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
  455. Where SaleBill.ID_Assessor Is Not Null
  456. And SaleBill.Date_SaleBill BETWEEN ISNULL(DATEADD(day, DATEDIFF(day, 0, @StartDate), 0), '1900-1-1') AND ISNULL(DATEADD(day, DATEDIFF(day, 0, DATEADD(day, 1, @EndDate)), 0), '9999-12-31')
  457. And SaleBill.No_SaleBill Between IsNull(@StartNo_SaleBill,No_SaleBill) And IsNull(@EndNo_SaleBill,No_SaleBill)
  458. And No_Customer Between IsNull(@StartNo_Customer,No_Customer) And IsNull(@EndNo_Customer,No_Customer)
  459. And No_Product Between IsNull(@StartNo_Product,No_Product) And IsNull(@EndNo_Product,No_Product)
  460. And Type_Product Between IsNull(@StartType_Product,Type_Product) And IsNull(@EndType_Product,Type_Product)
  461. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  462. Order By No_SaleBill,No_Product,No_SaleOutDepotBill
  463. ">
  464. <Params>
  465. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  466. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  467. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  468. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  469. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  470. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  471. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  472. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  473. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  474. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  475. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  476. </Params>
  477. <Tables>
  478. <Table name="FrmCostListBySaleBill"/>
  479. </Tables>
  480. </SearchCostListBySaleBill>
  481. </Search>
  482. </Server>
  483. <Lables>
  484. <Search>
  485. ;
  486. </Search>
  487. </Lables>
  488. </Form>
  489. </Forms>