FrmSaleNoBilling.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Forms>
  3. <Form Name="FrmSaleNoBilling">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="销货未开票";
  9. GetSchema();
  10. @CurrentRowIndex=0;
  11. if(Search("SearchSaleNoBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  12. {
  13. Search("SearchSaleNoBillProduct",#SaleNoBill.No_Bill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  14. }
  15. txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
  16. ]]>
  17. </Load>
  18. <Mode>
  19. <Search>
  20. <Lable name="Search" />
  21. </Search>
  22. </Mode>
  23. </Events>
  24. <Controls>
  25. <IKExtendGrid name="dgSaleBill" DataSource="SaleNoBill" TableStyleIndex="0">
  26. <DataColumn Index="0" DataSource="SaleNoBill.No_Bill" />
  27. <DataColumn Index="1" DataSource="SaleNoBill.Date"/>
  28. <DataColumn Index="2" DataSource="SaleNoBill.No_Customer" />
  29. <DataColumn Index="3" DataSource="SaleNoBill.ShortName_Customer" />
  30. <DataColumn Index="4" DataSource="SaleNoBill.GetMethod_Bill" />
  31. <DataColumn Index="5" DataSource="SaleNoBill.Name_Bill" />
  32. <Events>
  33. <ClickPaste>
  34. ;
  35. </ClickPaste>
  36. <ClickExcel>
  37. ;
  38. </ClickExcel>
  39. <!--<ClickExcel>
  40. Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  41. ExcelReport("FrmSaleNoBilling","SaleBillDetail");
  42. </ClickExcel>-->
  43. <ClickPrint>
  44. ;
  45. </ClickPrint>
  46. <ClickPreview>
  47. Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID() , dgSaleBill.SqlText);
  48. PrintReport("FrmSaleNoBilling","SaleBillDetail");
  49. </ClickPreview>
  50. <ClickRefresh>
  51. if(Search("SearchSaleNoBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
  52. {
  53. Search("SearchSaleNoBillProduct",#SaleNoBill.No_Bill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  54. }
  55. </ClickRefresh>
  56. <ClickFirstPage>
  57. ;
  58. </ClickFirstPage>
  59. <ClickPrevPage>
  60. ;
  61. </ClickPrevPage>
  62. <ClickNextPage>
  63. ;
  64. </ClickNextPage>
  65. <ClickLastPage>
  66. ;
  67. </ClickLastPage>
  68. <ClickFilter>
  69. <![CDATA[
  70. Empty("#SaleNoBillProduct");
  71. if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
  72. Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  73. txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
  74. ]]>
  75. </ClickFilter>
  76. <ClickNOFilter>
  77. <![CDATA[
  78. Empty("#SaleNoBillProduct");
  79. if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
  80. Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  81. txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
  82. ]]>
  83. </ClickNOFilter>
  84. <ClickAdd>
  85. ;
  86. </ClickAdd>
  87. <ClickRemove>
  88. ;
  89. </ClickRemove>
  90. <CurrentCellChanged>
  91. <![CDATA[
  92. if(dgSaleBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
  93. {
  94. @CurrentRowIndex=dgSaleBill.dataGrid.CurrentRowIndex;
  95. Empty("#SaleNoBillProduct");
  96. if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
  97. {
  98. Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  99. }
  100. txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
  101. }
  102. ]]>
  103. </CurrentCellChanged>
  104. </Events>
  105. </IKExtendGrid>
  106. <IKDataGridEx name="dgProduct" DataSource="SaleNoBillProduct" TableStyleIndex="0">
  107. <DataColumn Index="0" DataSource="SaleNoBillProduct.No_Product" />
  108. <DataColumn Index="1" DataSource="SaleNoBillProduct.Name_Product" />
  109. <DataColumn Index="2" DataSource="SaleNoBillProduct.Quantity_SaleBillProduct" />
  110. <DataColumn Index="3" DataSource="SaleNoBillProduct.UnitPrice_SaleBillProduct" />
  111. <DataColumn Index="4" DataSource="SaleNoBillProduct.TaxCurrency_SaleBill" />
  112. <DataColumn Index="5" DataSource="SaleNoBillProduct.MoneyCurrency" />
  113. <DataColumn Index="6" DataSource="SaleNoBillProduct.TaxCurrency" />
  114. </IKDataGridEx>
  115. </Controls>
  116. </Client>
  117. <Server>
  118. <Tables>
  119. <Table name="SaleNoBill" Type="Parent">
  120. <GetSchema CmdType="Text" CmdText="Select Top 0 Convert(nvarchar(64),'') As No_Bill
  121. ,Convert(datetime,0) As Date
  122. ,Convert(Nvarchar(64),'') as No_Customer
  123. ,Convert(Nvarchar(64),'') as ShortName_Customer
  124. ,Convert(Nvarchar(64),'') as GetMethod_Bill
  125. ,Convert(Nvarchar(64),'') as Name_Bill
  126. From SaleBill
  127. "/>
  128. </Table>
  129. <Table name="SaleNoBillProduct" Type="Child">
  130. <GetSchema CmdType="Text" CmdText="Select Top 0 Convert(nvarchar(64),'') As No_Product
  131. , Convert(nvarchar(64),'') As Name_Product
  132. , Convert(decimal,0.00) As Quantity_SaleBillProduct
  133. ,Convert(decimal,0.00) As UnitPrice_SaleBillProduct
  134. ,Convert(nvarchar(64),'') As TaxCurrency_SaleBill
  135. ,Convert(decimal,0.00) As MoneyCurrency
  136. ,Convert(decimal,0.00) As TaxCurrency
  137. From SaleBillProduct
  138. "/>
  139. </Table>
  140. </Tables>
  141. <Search>
  142. <SearchSaleNoBill CmdType="Text" CmdText="
  143. Select SaleBill.No_SaleBill as No_Bill
  144. ,Convert(datetime,SaleBill.Date_SaleBill) as Date
  145. ,No_Customer,ShortName_Customer
  146. ,SaleBill.GetMethod_SaleBill as GetMethod_Bill
  147. ,convert(nvarchar(64),'销货单') as Name_Bill
  148. From SaleBill
  149. Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  150. Where SaleBill.No_SaleBill in (
  151. select distinct No_SaleBill from (
  152. Select No_SaleBill From SaleBill
  153. left join SaleBillProduct ON SaleBillProduct.ID_SaleBill = SaleBill.ID_SaleBill
  154. left join
  155. (
  156. SELECT No_FromBill
  157. ,No_FromBillProduct
  158. ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
  159. From
  160. (
  161. Select No_FromBill
  162. ,No_FromBillProduct
  163. ,Quantity_SaleRtnBillProduct
  164. From SaleRtnBillProduct
  165. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  166. Where SaleRtnBill.ID_Assessor Is Not Null
  167. And SaleRtnBill.Disable_SaleRtnBill = 0
  168. )InnerA
  169. Group By No_FromBill,No_FromBillProduct
  170. )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
  171. WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
  172. And SaleBill.ID_Assessor is not null
  173. and SaleBill.Assess_SaleBill = 0
  174. And SaleBill.Disable_SaleBill = 0
  175. AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
  176. And SaleBill.Date_SaleBill >='2009-12-21 00:00:01' ) temp
  177. )
  178. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  179. Order by No_Bill
  180. ">
  181. <Params>
  182. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  183. </Params>
  184. <Tables>
  185. <Table name="SaleNoBill"/>
  186. </Tables>
  187. </SearchSaleNoBill>
  188. <SearchSaleNoBillProduct CmdType="Text" CmdText="
  189. declare @CessOut decimal(5,2)
  190. Select @CessOut = CessOut_SystemSetting/100 from SystemSetting
  191. Select Product.No_Product
  192. ,Product.Name_Product
  193. ,(SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) As Quantity_SaleBillProduct
  194. ,SaleBillProduct.UnitPrice_SaleBillProduct
  195. ,SaleBill.TaxCurrency_SaleBill
  196. ,case SaleBill.TaxCurrency_SaleBill
  197. When '内含'
  198. Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@CessOut))---IsNull(A.SaleRtnMoneyCurrency,0))
  199. else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))---IsNull(A.SaleRtnMoneyCurrency,0))
  200. end as MoneyCurrency --未税小计
  201. -- ,case SaleBill.TaxCurrency_SaleBill
  202. --when '外加'
  203. --then (Convert(decimal(18,2),Convert(decimal(18,2),SaleBillProduct.UnitPrice_SaleBillProduct*SaleBillProduct.Quantity_SaleBillProduct)*@CessOut)-IsNull(A.SaleRtnTaxCurrency,0))
  204. --when '内含' then (Convert(decimal(18,2),(Convert(decimal(18,2),SaleBillProduct.UnitPrice_SaleBillProduct*SaleBillProduct.Quantity_SaleBillProduct)*@CessOut)/(1+@CessOut))-IsNull(A.SaleRtnTaxCurrency,0))
  205. --else -IsNull(A.SaleRtnTaxCurrency,0)
  206. --end as TaxCurrency --含税小计
  207. ,
  208. case SaleBill.TaxCurrency_SaleBill
  209. When '外加'
  210. Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@CessOut))---IsNull(A.SaleRtnMoneyCurrency,0))
  211. else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))---IsNull(A.SaleRtnMoneyCurrency,0))
  212. end as TaxCurrency --含税小计
  213. --Convert(decimal(18,2),Convert(decimal(18,2),SaleBill.GoodsAmount_SaleBill +SaleBill.TaxAmount_SaleBill))-IsNull(A.SaleRtnTaxCurrency,0) as TaxCurrency
  214. From SaleBillProduct
  215. LEFT JOIN SaleBill ON SaleBill.ID_SaleBill = SaleBillProduct.ID_SaleBill
  216. LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
  217. LEFT JOIN Customer on Customer.ID_Customer = SaleBill.ID_Customer
  218. Left Join
  219. (
  220. SELECT No_FromBill
  221. ,No_FromBillProduct
  222. ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
  223. --,Sum(SaleRtnTaxCurrency) As SaleRtnTaxCurrency
  224. ,Sum(SaleRtnMoneyCurrency) As SaleRtnMoneyCurrency
  225. From
  226. (
  227. Select No_FromBill
  228. ,No_FromBillProduct
  229. ,Quantity_SaleRtnBillProduct
  230. ,case SaleRtnBill.TaxCurrency_SaleRtnBill
  231. When '内含'
  232. Then (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@CessOut)
  233. else (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)
  234. end as SaleRtnMoneyCurrency
  235. --,case SaleRtnBill.TaxCurrency_SaleRtnBill
  236. --when '外加'
  237. --then Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*SaleRtnBillProduct.Quantity_SaleRtnBillProduct)*@CessOut)
  238. --when '内含'
  239. --then Convert(decimal(18,2),(Convert(decimal(18,2),SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*SaleRtnBillProduct.Quantity_SaleRtnBillProduct)*@CessOut)/(1+@CessOut)) else 0
  240. --end as SaleRtnTaxCurrency
  241. ,Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBill.GoodsAmount_SaleRtnBill+SaleRtnBill.TaxAmount_SaleRtnBill))
  242. as SaleRtnTaxCurrency
  243. From SaleRtnBillProduct
  244. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  245. Where SaleRtnBill.ID_Assessor Is Not Null
  246. And SaleRtnBill.Disable_SaleRtnBill = 0
  247. )InnerA
  248. Group By No_FromBill,No_FromBillProduct
  249. )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
  250. WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
  251. And SaleBill.ID_Assessor is not null
  252. And SaleBill.Disable_SaleBill = 0
  253. and SaleBill.Assess_SaleBill = 0
  254. AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
  255. and No_SaleBill=@No_Bill
  256. Order by Customer.No_Customer,SaleBill.No_SaleBill,Product.No_Product
  257. ">
  258. <Params>
  259. <Param name="@No_Bill" type="SaleBill.No_SaleBill" Index="0" />
  260. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  261. </Params>
  262. <Tables>
  263. <Table name="SaleNoBillProduct"/>
  264. </Tables>
  265. </SearchSaleNoBillProduct>
  266. <SearchTotal CmdType="Text" CmdText="
  267. declare @Sql nvarchar(4000)
  268. select @Sql = '
  269. declare @CessOut decimal(5,2)
  270. Select @CessOut = CessOut_SystemSetting/100 from SystemSetting
  271. Select * From
  272. (
  273. Select SaleBill.No_SaleBill as No_Bill,Convert(datetime,SaleBill.Date_SaleBill) as Date
  274. ,No_Customer,ShortName_Customer
  275. ,SaleBill.GetMethod_SaleBill as GetMethod_Bill,convert(nvarchar(64), ' + '''' + '销货单' + '''' + ') as Name_Bill
  276. ,No_Product,Name_Product
  277. ,(SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) As Quantity_SaleBillProduct
  278. ,SaleBillProduct.UnitPrice_SaleBillProduct
  279. ,SaleBill.TaxCurrency_SaleBill
  280. ,case SaleBill.TaxCurrency_SaleBill
  281. When ' + '''' + '内含' + '''' +
  282. 'Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@CessOut))
  283. else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))
  284. end as MoneyCurrency --未税小计
  285. ,
  286. case SaleBill.TaxCurrency_SaleBill
  287. When ' + '''' + '外加' + '''' +
  288. 'Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@CessOut))
  289. else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))
  290. end as TaxCurrency --含税小计
  291. From SaleBill
  292. LEFT JOIN SaleBillProduct ON SaleBillProduct.ID_SaleBill = SaleBill.ID_SaleBill
  293. LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
  294. LEFT JOIN Customer on Customer.ID_Customer = SaleBill.ID_Customer
  295. Left Join
  296. (
  297. SELECT No_FromBill
  298. ,No_FromBillProduct
  299. ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
  300. ,Sum(SaleRtnTaxCurrency) As SaleRtnTaxCurrency
  301. ,Sum(SaleRtnMoneyCurrency) As SaleRtnMoneyCurrency
  302. From
  303. (
  304. Select No_FromBill
  305. ,No_FromBillProduct
  306. ,Quantity_SaleRtnBillProduct
  307. ,case SaleRtnBill.TaxCurrency_SaleRtnBill
  308. When ' + '''' + '内含' + '''' +
  309. ' Then (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@CessOut)
  310. else (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)
  311. end as SaleRtnMoneyCurrency
  312. ,Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBill.GoodsAmount_SaleRtnBill+SaleRtnBill.TaxAmount_SaleRtnBill)
  313. ) as SaleRtnTaxCurrency
  314. From SaleRtnBillProduct
  315. Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  316. Where SaleRtnBill.ID_Assessor Is Not Null
  317. And SaleRtnBill.Disable_SaleRtnBill = 0
  318. )InnerA
  319. Group By No_FromBill,No_FromBillProduct
  320. )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
  321. WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
  322. And SaleBill.ID_Assessor is not null
  323. And SaleBill.Disable_SaleBill = 0
  324. and SaleBill.Assess_SaleBill = 0
  325. AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
  326. --And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
  327. And SaleBill.Date_SaleBill >=' + '''' + '2009-12-21 00:00:01' + '''' +
  328. ')B
  329. ' +
  330. @Where + '
  331. order by B.No_Bill'
  332. exec sp_sqlexec @Sql
  333. ">
  334. <Params>
  335. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  336. <Param name="@Where" type="SaleBill.SendAddr_SaleBill" Index="1" />
  337. </Params>
  338. <Tables>
  339. <Table name="SaleBillDetail"/>
  340. </Tables>
  341. </SearchTotal>
  342. </Search>
  343. </Server>
  344. <Lables>
  345. <Search>
  346. </Search>
  347. <New>
  348. </New>
  349. <View>
  350. </View>
  351. <Modify>
  352. </Modify>
  353. </Lables>
  354. </Form>
  355. </Forms>