FrmInventoryCheck.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmInventoryCheck">
  4. <Client>
  5. <Events>
  6. <Load><![CDATA[
  7. @Title="盘点查询";
  8. GetSchema();
  9. Search("SearchLocation");
  10. Search("SearchType");
  11. ChangeMode("Search");
  12. ]]></Load>
  13. <EndLoad>
  14. for(@i=0;@i &lt; CLB_Location.GetItemsCount();@i++)
  15. CLB_Location.SetItemChecked(@i,true);
  16. </EndLoad>
  17. <Closing>
  18. ;
  19. </Closing>
  20. <Closed>
  21. ;
  22. </Closed>
  23. </Events>
  24. <Mode>
  25. <Search>
  26. <Lable name="Search"/>
  27. </Search>
  28. </Mode>
  29. <Controls>
  30. <IKCheckedListBoxEx name="CLB_Location" DataSource="Location" DisplayMember="Name_location" ValueMember="ID_Location">
  31. <Events>
  32. <ItemCheck>
  33. if(CLB_Location.SelectedIndex == 0)
  34. CLB_Location.SelectAllItems();
  35. </ItemCheck>
  36. </Events>
  37. </IKCheckedListBoxEx>
  38. <IKTextButton name="tbProduct1">
  39. <Events>
  40. <Click>
  41. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
  42. if( @temp == "" )
  43. return;
  44. tbProduct1.CValue = @temp;
  45. </Click>
  46. <TextBoxButtonTextChanged>
  47. tbProduct2.CValue = tbProduct1.CValue;
  48. </TextBoxButtonTextChanged>
  49. </Events>
  50. </IKTextButton>
  51. <IKTextButton name="tbProduct2">
  52. <Events>
  53. <Click>
  54. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
  55. if( @temp == "" )
  56. return;
  57. tbProduct2.CValue = @temp;
  58. </Click>
  59. </Events>
  60. </IKTextButton>
  61. <IKComboBoxEx name="cbTypeFrom" DataSource="Type" DisplayMember="Name_TypeDef" >
  62. <Events>
  63. <TextChanged>
  64. cbTypeTo.Text = cbTypeFrom.Text;
  65. </TextChanged>
  66. </Events>
  67. </IKComboBoxEx>
  68. <IKComboBoxEx name="cbTypeTo" DataSource="Type" DisplayMember="Name_TypeDef" />
  69. <IKDateTimePicker name = "dtStart">
  70. <Events>
  71. <CheckedChanged>
  72. dtEnd.Checked = dtStart.Checked;
  73. </CheckedChanged>
  74. <ValueChanged>
  75. dtEnd.CValue = dtStart.CValue;
  76. </ValueChanged>
  77. </Events>
  78. </IKDateTimePicker>
  79. <IKExtendGrid name="dgProduct" DataSource="FrmInventoryCheck" TableStyleIndex="0">
  80. <DataColumn Index="0" DataSource="FrmInventoryCheck.No_Product"/>
  81. <DataColumn Index="1" DataSource="FrmInventoryCheck.Name_Product"/>
  82. <DataColumn Index="2" DataSource="FrmInventoryCheck.No_StocktakingBill"/>
  83. <DataColumn Index="3" DataSource="FrmInventoryCheck.Date_StocktakingBill"/>
  84. <DataColumn Index="4" DataSource="FrmInventoryCheck.StockQty_StocktakingBillProduct"/>
  85. <DataColumn Index="5" DataSource="FrmInventoryCheck.Quantity_StocktakingBillProduct"/>
  86. <DataColumn Index="6" DataSource="FrmInventoryCheck.Quantity_Difference"/>
  87. <DataColumn Index="7" DataSource="FrmInventoryCheck.Comment_StocktakingBillProduct"/>
  88. <Events>
  89. <ClickPreview>
  90. PrintReport(dgProduct.CurrentView,"FrmInventoryCheck","FrmInventoryCheck");
  91. </ClickPreview>
  92. <ClickFilter>
  93. ;
  94. </ClickFilter>
  95. <ClickNOFilter>
  96. ;
  97. </ClickNOFilter>
  98. <ClickRefresh>
  99. Empty();
  100. <Lable name="btnActionClick"/>
  101. </ClickRefresh>
  102. </Events>
  103. </IKExtendGrid>
  104. <IKButton name="btnSearch">
  105. <Events>
  106. <Click>
  107. <Lable name="btnActionClick"/>
  108. </Click>
  109. </Events>
  110. </IKButton>
  111. <IKButton name="btnEmpty">
  112. <Events>
  113. <Click>
  114. Empty();
  115. tbProduct1.CValue="";
  116. tbProduct2.CValue="";
  117. cbTypeFrom.Text="";
  118. cbTypeTo.Text="";
  119. dtStart.Checked=False;
  120. dtEnd.Checked=False;
  121. </Click>
  122. </Events>
  123. </IKButton>
  124. </Controls>
  125. <ChildForms>
  126. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo=""
  127. MappingName="产品">
  128. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" />
  129. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
  130. </ChildForm>
  131. </ChildForms>
  132. </Client>
  133. <Server>
  134. <Tables>
  135. <Table name="FrmInventoryCheck" Type="Child">
  136. <GetSchema CmdType="Text" CmdText="
  137. Select Top 0 No_StocktakingBill,Date_StocktakingBill,No_Product,Name_Product,Type_Product,B.Name_Location,StockQty_StocktakingBillProduct,Quantity_StocktakingBillProduct,(StockQty_StocktakingBillProduct-Quantity_StocktakingBillProduct) As Quantity_Difference,Comment_StocktakingBillProduct
  138. From StocktakingBill
  139. Join StocktakingBillProduct On StocktakingBill.ID_StocktakingBill=StocktakingBillProduct.ID_StocktakingBill
  140. Join Product ON Product.ID_Product=StocktakingBillProduct.ID_Product
  141. Join Location A On A.ID_Location=StocktakingBill.ID_Location
  142. Join Location B On B.ID_Location=StocktakingBillProduct.ID_Location
  143. "/>
  144. </Table>
  145. </Tables>
  146. <Search>
  147. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  148. <Tables>
  149. <Table name="AllProduct" />
  150. </Tables>
  151. </SearchAllProduct>
  152. <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef From TypeDef Where Type_TypeDef=8 Order By Name_TypeDef ">
  153. <Tables>
  154. <Table name="Type"/>
  155. </Tables>
  156. </SearchType>
  157. <SearchLocation CmdType="Text" CmdText="Select Name_Location,ID_Location from Location where Level_Location = 0">
  158. <Tables>
  159. <Table name="Location"/>
  160. </Tables>
  161. </SearchLocation>
  162. <SearchInventoryCheck CmdType="Text" CmdText="
  163. declare @sqlCmd nvarchar(2000)
  164. set @sqlCmd=N'Select No_StocktakingBill,Date_StocktakingBill,No_Product,Name_Product,Type_Product,B.Name_Location,StockQty_StocktakingBillProduct,Quantity_StocktakingBillProduct,(Quantity_StocktakingBillProduct-StockQty_StocktakingBillProduct) As Quantity_Difference,Comment_StocktakingBillProduct
  165. From StocktakingBill
  166. Join StocktakingBillProduct On StocktakingBill.ID_StocktakingBill=StocktakingBillProduct.ID_StocktakingBill
  167. Join Product ON Product.ID_Product=StocktakingBillProduct.ID_Product
  168. Join Location A On A.ID_Location=StocktakingBill.ID_Location
  169. Join Location B On B.ID_Location=StocktakingBillProduct.ID_Location
  170. Where StocktakingBill.ID_Assessor Is Not Null And A.Name_Location IN '+@SqlLocation
  171. If(@StartDate_StocktakingBill Is Not Null)
  172. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate_StocktakingBill)+nchar(39)+N', StocktakingBill.Date_StocktakingBill) &gt;= 0 '
  173. if(@EndDate_StocktakingBill Is Not Null)
  174. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate_StocktakingBill)+nchar(39)+N', StocktakingBill.Date_StocktakingBill) &lt;= 0 '
  175. if(@StartNo_Product Is Not Null)
  176. set @sqlCmd=@sqlCmd+N' And No_Product &gt;= '+nchar(39)+@StartNo_Product+nchar(39)
  177. if(@EndNo_Product Is Not Null)
  178. set @sqlCmd=@sqlCmd+N' And No_Product &lt;= '+nchar(39)+@EndNo_Product+nchar(39)
  179. if(@StartType_Product Is Not Null)
  180. set @sqlCmd=@sqlCmd+N' And Type_Product &gt;= '+nchar(39)+@StartType_Product+nchar(39)
  181. if(@EndType_Product Is Not Null)
  182. set @sqlCmd=@sqlCmd+N' And Type_Product &lt;= '+nchar(39)+@EndType_Product+nchar(39)
  183. set @sqlCmd=@sqlCmd+N' Order By No_Product'
  184. --print @sqlCmd
  185. --print @SqlLocation
  186. execute sp_executesql @sqlCmd
  187. ">
  188. <Params>
  189. <Param name="@StartNo_Product" type="Product.No_Product" Index="0" />
  190. <Param name="@EndNo_Product" type="Product.No_Product" Index="1" />
  191. <Param name="@StartType_Product" type="Product.No_Product" Index="2" />
  192. <Param name="@EndType_Product" type="Product.No_Product" Index="3" />
  193. <Param name="@StartDate_StocktakingBill" type="StocktakingBill.Date_StocktakingBill" Index="4" />
  194. <Param name="@EndDate_StocktakingBill" type="StocktakingBill.Date_StocktakingBill" Index="5" />
  195. <Param name="@SqlLocation" type="PurchaseInDepotBill.Comment_PurchaseInDepotBill" Index="6" />
  196. </Params>
  197. <Tables>
  198. <Table name="FrmInventoryCheck" />
  199. </Tables>
  200. </SearchInventoryCheck>
  201. </Search>
  202. </Server>
  203. <Lables>
  204. <Search>
  205. Empty();
  206. NewInstance();
  207. </Search>
  208. <btnActionClick>
  209. @sqlLocation="(";
  210. @empty=true;
  211. @first=true;
  212. for(@i=1;@i &lt; CLB_Location.GetItemsCount();@i++){
  213. if(CLB_Location.GetItemChecked(@i)){
  214. @empty=false;
  215. if(@first==true){
  216. @sqlLocation=@sqlLocation+"'"+CLB_Location.GetSelectedName(@i)+"'";
  217. @first=false;
  218. }else{
  219. @sqlLocation=@sqlLocation+","+"'"+CLB_Location.GetSelectedName(@i)+"'";
  220. }
  221. }
  222. }
  223. @sqlLocation=@sqlLocation+") ";
  224. if(@empty==true)
  225. {
  226. MessageBox("请选择仓库!",@Title);
  227. return;
  228. }
  229. @StartNo_Product=DBNull();
  230. @EndNo_Product=DBNull();
  231. @StartType_Product=DBNull();
  232. @EndType_Product=DBNull();
  233. @StartDate_StocktakingBill=DBNull();
  234. @EndDate_StocktakingBill=DBNull();
  235. if(tbProduct1.CValue!="")
  236. @StartNo_Product=tbProduct1.CValue;
  237. if(tbProduct2.CValue!="")
  238. @EndNo_Product=tbProduct2.CValue;
  239. if(cbTypeFrom.Text!="")
  240. @StartType_Product=cbTypeFrom.Text;
  241. if(cbTypeTo.Text!="")
  242. @EndType_Product=cbTypeTo.Text;
  243. if(dtStart.Checked)
  244. @StartDate_StocktakingBill=dtStart.Value;
  245. if(dtEnd.Checked)
  246. @EndDate_StocktakingBill=dtEnd.Value;
  247. Search("SearchInventoryCheck",@StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@StartDate_StocktakingBill,@EndDate_StocktakingBill,@sqlLocation);
  248. </btnActionClick>
  249. </Lables>
  250. </Form>
  251. </Forms>