ContinuousPrintSql.xml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <PrintSqlDataSet>
  3. <PrintSql>
  4. <FormName>FrmSaleBill</FormName>
  5. <SqlText>
  6. <![CDATA[
  7. Declare @StartNo nvarchar(64)
  8. Declare @EndNo nvarchar(64)
  9. Declare @Special bit
  10. set @StartNo = '{0}'
  11. set @EndNo = '{1}'
  12. set @Special={2}
  13. SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
  14. Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  15. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  16. Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal,Employee.Name_Employee AS Principal_SaleBill,Customer.ID_Creator As CustomerCreator
  17. FROM SaleBill
  18. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  19. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  20. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  21. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  22. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  23. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  24. WHERE SaleBill.No_SaleBill >= (case DataLength(@StartNo) when 0 then SaleBill.No_SaleBill else @StartNo end) and SaleBill.No_SaleBill <= (case DataLength(@EndNo) when 0 then SaleBill.No_SaleBill else @EndNo end)
  25. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
  26. SELECT SaleBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  27. Product.LowSalePrice_Product, BillType.Name_BillType,
  28. (SaleBillProduct.Quantity_SaleBillProduct * SaleBillProduct.UnitPrice_SaleBillProduct ) AS Amount_SaleBillProduct ,SaleBill.No_SaleBill
  29. FROM SaleBillProduct
  30. LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
  31. LEFT JOIN BillType ON BillType.Value_BillType = SaleBillProduct.Type_FromBill
  32. LEFT JOIN SaleBill ON SaleBillProduct.ID_SaleBill = SaleBill.ID_SaleBill
  33. WHERE SaleBill.No_SaleBill >= (case DataLength(@StartNo) when 0 then SaleBill.No_SaleBill else @StartNo end) and SaleBill.No_SaleBill <= (case DataLength(@EndNo) when 0 then SaleBill.No_SaleBill else @EndNo end)
  34. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
  35. ORDER BY CAST(SaleBillProduct.No_SaleBillProduct AS INT)
  36. SELECT ReportComment.*, SaleBill.No_SaleBill
  37. FROM ReportComment
  38. LEFT JOIN SaleBill ON ReportComment.ID_Bill = SaleBill.ID_SaleBill
  39. WHERE SaleBill.No_SaleBill >= (case DataLength(@StartNo) when 0 then SaleBill.No_SaleBill else @StartNo end) and SaleBill.No_SaleBill <= (case DataLength(@EndNo) when 0 then SaleBill.No_SaleBill else @EndNo end)
  40. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End --added for Special
  41. ORDER BY ReportComment.No_ReportComment
  42. ]]>
  43. </SqlText>
  44. <TableName>SaleBill,SaleBillProduct,ReportComment</TableName>
  45. </PrintSql>
  46. <PrintSql>
  47. <FormName>FrmIndentBill</FormName>
  48. <SqlText>
  49. <![CDATA[
  50. Declare @StartNo nvarchar(64)
  51. Declare @EndNo nvarchar(64)
  52. Declare @Special bit
  53. set @StartNo = '{0}'
  54. set @EndNo = '{1}'
  55. set @Special={2}
  56. SELECT IndentBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
  57. Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  58. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  59. Location.No_Location, Location.Name_Location, Employee.No_Employee AS No_Principal,Employee.Name_Employee AS Principal_IndentBill,Customer.ID_Creator As CustomerCreator
  60. FROM IndentBill
  61. LEFT JOIN Customer ON Customer.ID_Customer = IndentBill.ID_Customer
  62. LEFT JOIN AppUser a ON a.ID_User = IndentBill.ID_Creator
  63. LEFT JOIN AppUser b ON b.ID_User = IndentBill.ID_Assessor
  64. LEFT JOIN AppUser c ON c.ID_User = IndentBill.LastModUser_IndentBill
  65. LEFT JOIN Location ON Location.ID_Location = IndentBill.ID_Location
  66. LEFT JOIN Employee ON Employee.ID_Employee = IndentBill.ID_Principal
  67. WHERE IndentBill.No_IndentBill >= (case DataLength(@StartNo) when 0 then IndentBill.No_IndentBill else @StartNo end) and IndentBill.No_IndentBill <= (case DataLength(@EndNo) when 0 then IndentBill.No_IndentBill else @EndNo end)
  68. and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
  69. SELECT IndentBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  70. Product.LowSalePrice_Product, BillType.Name_BillType,
  71. (IndentBillProduct.Quantity_IndentBillProduct * IndentBillProduct.UnitPrice_IndentBillProduct ) AS Amount_IndentBillProduct ,IndentBill.No_IndentBill
  72. FROM IndentBillProduct
  73. LEFT JOIN Product ON Product.ID_Product = IndentBillProduct.ID_Product
  74. LEFT JOIN BillType ON BillType.Value_BillType = IndentBillProduct.Type_FromBill
  75. LEFT JOIN IndentBill ON IndentBillProduct.ID_IndentBill = IndentBill.ID_IndentBill
  76. WHERE IndentBill.No_IndentBill >= (case DataLength(@StartNo) when 0 then IndentBill.No_IndentBill else @StartNo end) and IndentBill.No_IndentBill <= (case DataLength(@EndNo) when 0 then IndentBill.No_IndentBill else @EndNo end)
  77. and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
  78. ORDER BY CAST(IndentBillProduct.No_IndentBillProduct AS INT)
  79. SELECT ReportComment.*, IndentBill.No_IndentBill
  80. FROM ReportComment
  81. LEFT JOIN IndentBill ON ReportComment.ID_Bill = IndentBill.ID_IndentBill
  82. WHERE IndentBill.No_IndentBill >= (case DataLength(@StartNo) when 0 then IndentBill.No_IndentBill else @StartNo end) and IndentBill.No_IndentBill <= (case DataLength(@EndNo) when 0 then IndentBill.No_IndentBill else @EndNo end)
  83. and Special_IndentBill=case @Special when 1 then Special_IndentBill else 0 End --added for Special
  84. ORDER BY ReportComment.No_ReportComment
  85. ]]>
  86. </SqlText>
  87. <TableName>IndentBill,IndentBillProduct,ReportComment</TableName>
  88. </PrintSql>
  89. <PrintSql>
  90. <FormName>FrmPriceQueryBill</FormName>
  91. <SqlText>
  92. <![CDATA[
  93. Declare @StartNo nvarchar(64)
  94. Declare @EndNo nvarchar(64)
  95. set @StartNo = '{0}'
  96. set @EndNo = '{1}'
  97. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  98. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  99. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  100. Employee.No_Employee AS No_Principal,Customer.ID_Creator As CustomerCreator,Employee.Name_Employee as Principal_PriceQueryBill
  101. FROM PriceQueryBill
  102. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  103. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  104. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  105. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  106. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  107. WHERE PriceQueryBill.No_PriceQueryBill >= (case DataLength(@StartNo) when 0 then PriceQueryBill.No_PriceQueryBill else @StartNo end) and PriceQueryBill.No_PriceQueryBill <= (case DataLength(@EndNo) when 0 then PriceQueryBill.No_PriceQueryBill else @EndNo end)
  108. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  109. Product.LowSalePrice_Product,
  110. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,
  111. PriceQueryBill.No_PriceQueryBill
  112. FROM PriceQueryBillProduct
  113. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  114. LEFT JOIN PriceQueryBill ON PriceQueryBillProduct.ID_PriceQueryBill=PriceQueryBill.ID_PriceQueryBill
  115. WHERE PriceQueryBill.No_PriceQueryBill >= (case DataLength(@StartNo) when 0 then PriceQueryBill.No_PriceQueryBill else @StartNo end) and PriceQueryBill.No_PriceQueryBill <= (case DataLength(@EndNo) when 0 then PriceQueryBill.No_PriceQueryBill else @EndNo end)
  116. ORDER BY CAST(PriceQueryBillProduct.No_PriceQueryBillProduct AS INT)
  117. SELECT ReportComment.*, PriceQueryBill.No_PriceQueryBill
  118. FROM ReportComment
  119. LEFT JOIN PriceQueryBill ON ReportComment.ID_Bill=PriceQueryBill.ID_PriceQueryBill
  120. WHERE PriceQueryBill.No_PriceQueryBill >= (case DataLength(@StartNo) when 0 then PriceQueryBill.No_PriceQueryBill else @StartNo end) and PriceQueryBill.No_PriceQueryBill <=(case DataLength(@EndNo) when 0 then PriceQueryBill.No_PriceQueryBill else @EndNo end)
  121. ORDER BY ReportComment.No_ReportComment
  122. ]]>
  123. </SqlText>
  124. <TableName>PriceQueryBill,PriceQueryBillProduct,ReportComment</TableName>
  125. </PrintSql>
  126. <PrintSql>
  127. <FormName>FrmSaleRtnBill</FormName>
  128. <SqlText>
  129. <![CDATA[
  130. Declare @StartNo nvarchar(64)
  131. Declare @EndNo nvarchar(64)
  132. set @StartNo = '{0}'
  133. set @EndNo = '{1}'
  134. DECLARE @ID_SaleOutDepotBill uniqueidentifier
  135. SELECT @ID_SaleOutDepotBill = ID_SaleOutDepotBill FROM SaleOutDepotBill JOIN SaleRtnBillProduct ON SaleOutDepotBill.No_SaleOutDepotBill = SaleRtnBillProduct.No_FromBill
  136. SELECT SaleRtnBill.*, Customer.No_Customer, Customer.ShortName_Customer, Location.Name_Location,Location.No_Location,Customer.ID_Creator As CustomerCreator,
  137. SaleRtnBill.IsPrevBill_SaleRtnBill,
  138. SaleRtnBill.AssessDate_SaleRtnBill,
  139. AppUser.LoginName_User as Name_Creator, Employee.No_Employee AS No_Principal,
  140. Employee.Name_Employee AS Principal_SaleRtnBill,
  141. A1.LoginName_User as Name_Assessor,
  142. A2.LoginName_User as LastModUserName_SaleRtnBill
  143. FROM SaleRtnBill
  144. JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
  145. JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
  146. JOIN AppUser ON AppUser.ID_User = SaleRtnBill.ID_Creator
  147. LEFT JOIN AppUser A1 ON A1.ID_User = SaleRtnBill.ID_Assessor
  148. LEFT JOIN AppUser A2 ON A2.ID_User = SaleRtnBill.LastModUser_SaleRtnBill
  149. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  150. WHERE SaleRtnBill.No_SaleRtnBill>=(case DataLength(@StartNo) when 0 then SaleRtnBill.No_SaleRtnBill else @StartNo end) and SaleRtnBill.No_SaleRtnBill<=(case DataLength(@EndNo) when 0 then SaleRtnBill.No_SaleRtnBill else @EndNo end) AND Disable_SaleRtnBill=0
  151. ORDER BY No_SaleRtnBill
  152. SELECT SaleRtnBillProduct.*, SaleRtnBill.No_SaleRtnBill,
  153. BillType.Name_BillType AS FromBill_SaleRtnBillProduct,
  154. SaleRtnBill.IsPrevBill_SaleRtnBill,
  155. SaleRtnBill.AssessDate_SaleRtnBill,
  156. Product.No_Product AS ProductNo_SaleRtnBillProduct,
  157. Product.Name_Product AS ProductName_SaleRtnBillProduct,
  158. Product.Unit_Product AS ProductUnit_SaleRtnBillProduct,
  159. SaleOutDepotBillProduct.UnitCost_SaleOutDepotBillProduct AS UnitCost_SaleRtnBillProduct,
  160. SaleRtnBillProduct.Quantity_SaleRtnBillProduct * SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct AS Cash_SaleRtnBillProduct,SaleRtnBill.No_SaleRtnBill
  161. FROM SaleRtnBillProduct
  162. JOIN SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  163. JOIN Product ON Product.ID_Product=SaleRtnBillProduct.ID_Product
  164. JOIN BillType ON BillType.Value_BillType=SaleRtnBillProduct.Type_FromBill
  165. LEFT JOIN SaleOutDepotBillProduct ON SaleOutDepotBillProduct.No_SaleOutDepotBillProduct=SaleRtnBillProduct.No_FromBillProduct
  166. AND SaleOutDepotBillProduct.ID_SaleOutDepotBill=@ID_SaleOutDepotBill
  167. WHERE SaleRtnBill.No_SaleRtnBill>=(case DataLength(@StartNo) when 0 then SaleRtnBill.No_SaleRtnBill else @StartNo end) and SaleRtnBill.No_SaleRtnBill<=(case DataLength(@EndNo) when 0 then SaleRtnBill.No_SaleRtnBill else @EndNo end) AND Disable_SaleRtnBill=0
  168. ORDER BY CAST(No_SaleRtnBillProduct AS INT)
  169. ]]>
  170. </SqlText>
  171. <TableName>SaleRtnBill,SaleRtnBillProduct</TableName>
  172. </PrintSql>
  173. <PrintSql>
  174. <FormName>FrmPurchaseBill</FormName>
  175. <SqlText>
  176. <![CDATA[
  177. declare @StartNo nvarchar(64)
  178. declare @EndNo nvarchar(64)
  179. set @StartNo = '{0}'
  180. set @EndNo = '{1}'
  181. SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  182. FROM PurchaseOrderBill
  183. LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
  184. LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
  185. LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
  186. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
  187. LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
  188. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
  189. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
  190. WHERE No_PurchaseOrderBill between (case DataLength(@StartNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @EndNo end)
  191. AND Disable_PurchaseOrderBill=0
  192. SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,PurchaseOrderBill.No_PurchaseOrderBill as No_PurchaseOrderBill
  193. FROM PurchaseOrderBillProduct
  194. LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
  195. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
  196. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBillProduct.ID_PurchaseOrderBill=PurchaseOrderBill.ID_PurchaseOrderBill
  197. WHERE No_PurchaseOrderBill between (case DataLength(@StartNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @EndNo end)
  198. AND Disable_PurchaseOrderBill=0
  199. Order By CAST(No_PurchaseOrderBillProduct AS INT)
  200. SELECT ReportComment.*,PurchaseOrderBill.No_PurchaseOrderBill
  201. FROM ReportComment
  202. LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=ReportComment.ID_Bill
  203. WHERE No_PurchaseOrderBill between (case DataLength(@StartNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseOrderBill.No_PurchaseOrderBill else @EndNo end)
  204. AND Disable_PurchaseOrderBill=0
  205. ORDER BY ReportComment.No_ReportComment
  206. ]]>
  207. </SqlText>
  208. <TableName>PurchaseOrderBill,PurchaseOrderBillProduct,ReportComment</TableName>
  209. </PrintSql>
  210. <PrintSql>
  211. <FormName>FrmPurchaseQueryBill</FormName>
  212. <SqlText>
  213. <![CDATA[
  214. declare @StartNo nvarchar(64)
  215. declare @EndNo nvarchar(64)
  216. set @StartNo = '{0}'
  217. set @EndNo = '{1}'
  218. SELECT PurchaseQueryBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
  219. FROM PurchaseQueryBill
  220. LEFT JOIN AppUser a ON a.ID_User=PurchaseQueryBill.ID_Creator
  221. LEFT JOIN AppUser b ON b.ID_User=PurchaseQueryBill.ID_Assessor
  222. LEFT JOIN AppUser c ON c.ID_User=PurchaseQueryBill.LastModUser_PurchaseQueryBill
  223. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseQueryBill.ID_Supplier
  224. LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseQueryBill.ID_Principal
  225. LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseQueryBill.Name_Linkman
  226. WHERE No_PurchaseQueryBill between (case DataLength(@StartNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @EndNo end)
  227. SELECT PurchaseQueryBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct*PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct As Money, PurchaseQueryBill.No_PurchaseQueryBill as No_PurchaseQueryBill
  228. From PurchaseQueryBillProduct
  229. LEFT JOIN Product ON PurchaseQueryBillProduct.ID_Product=Product.ID_Product
  230. LEFT JOIN PurchaseQueryBill ON PurchaseQueryBillProduct.ID_PurchaseQueryBill=PurchaseQueryBill.ID_PurchaseQueryBill
  231. WHERE No_PurchaseQueryBill between (case DataLength(@StartNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @EndNo end)
  232. Order By CAST(PurchaseQueryBillProduct.No_PurchaseQueryBillProduct AS INT)
  233. SELECT ReportComment.*,PurchaseQueryBill.No_PurchaseQueryBill
  234. FROM ReportComment
  235. LEFT JOIN PurchaseQueryBill ON PurchaseQueryBill.ID_PurchaseQueryBill=ReportComment.ID_Bill
  236. WHERE No_PurchaseQueryBill between (case DataLength(@StartNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @StartNo end) and (case DataLength(@EndNo) when 0 then PurchaseQueryBill.No_PurchaseQueryBill else @EndNo end)
  237. ORDER BY ReportComment.No_ReportComment
  238. ]]>
  239. </SqlText>
  240. <TableName>PurchaseQueryBill,PurchaseQueryBillProduct,ReportComment</TableName>
  241. </PrintSql>
  242. <PrintSql>
  243. <FormName>FrmPurchaseInDepotBill</FormName>
  244. <SqlText>
  245. <![CDATA[
  246. Declare @StartNo_PurchaseInDepotBill nvarchar(64)
  247. Declare @EndNo_PurchaseInDepotBill nvarchar(64)
  248. Set @StartNo_PurchaseInDepotBill='{0}'
  249. Set @EndNo_PurchaseInDepotBill='{1}'
  250. SELECT PurchaseInDepotBill.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Location.Name_Location,Location.No_Location,Employee.No_Employee As No_Principal,Employee.Name_Employee As Name_Principal,Supplier.No_Supplier,Supplier.ShortName_Supplier
  251. FROM PurchaseInDepotBill
  252. LEFT JOIN AppUser a ON PurchaseInDepotBill.ID_Creator=a.ID_User
  253. LEFT JOIN AppUser b ON PurchaseInDepotBill.ID_Assessor=b.ID_User
  254. LEFT JOIN AppUser c ON PurchaseInDepotBill.LastModUser_PurchaseInDepotBill=c.ID_User
  255. LEFT JOIN Location ON PurchaseInDepotBill.ID_Location=Location.ID_Location
  256. LEFT JOIN Employee ON Employee.ID_Employee=PurchaseInDepotBill.ID_QA
  257. LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
  258. WHERE No_PurchaseInDepotBill >= (case DataLength(@StartNo_PurchaseInDepotBill) When 0 Then No_PurchaseInDepotBill Else @StartNo_PurchaseInDepotBill End) And No_PurchaseInDepotBill <= (case DataLength(@EndNo_PurchaseInDepotBill) When 0 Then No_PurchaseInDepotBill Else @EndNo_PurchaseInDepotBill End)
  259. SELECT PurchaseInDepotBill.No_PurchaseInDepotBill,PurchaseInDepotBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,Location.Name_Location,BillType.Name_BillType
  260. FROM PurchaseInDepotBillProduct
  261. LEFT JOIN Product ON PurchaseInDepotBillProduct.ID_Product=Product.ID_Product
  262. LEFT JOIN PurchaseInDepotBill ON PurchaseInDepotBillProduct.ID_PurchaseInDepotBill=PurchaseInDepotBill.ID_PurchaseInDepotBill
  263. LEFT JOIN Location ON Location.ID_Location=PurchaseInDepotBillProduct.ID_Location
  264. LEFT JOIN BillType ON BillType.Value_BillType=PurchaseInDepotBillProduct.Type_FromBill
  265. WHERE No_PurchaseInDepotBill >= (case DataLength(@StartNo_PurchaseInDepotBill) When 0 Then No_PurchaseInDepotBill Else @StartNo_PurchaseInDepotBill End) And No_PurchaseInDepotBill <= (case DataLength(@EndNo_PurchaseInDepotBill) When 0 Then No_PurchaseInDepotBill Else @EndNo_PurchaseInDepotBill End)
  266. ORDER BY CAST(No_PurchaseInDepotBillProduct AS INT)
  267. ]]>
  268. </SqlText>
  269. <TableName>PurchaseInDepotBill,PurchaseInDepotBillProduct</TableName>
  270. </PrintSql>
  271. <PrintSql>
  272. <FormName>FrmSaleOutDepotBill</FormName>
  273. <SqlText>
  274. <![CDATA[
  275. Declare @StartNo_SaleOutDepotBill nvarchar(64)
  276. Declare @EndNo_SaleOutDepotBill nvarchar(64)
  277. Declare @Right nvarchar(64)
  278. Set @StartNo_SaleOutDepotBill='{0}'
  279. Set @EndNo_SaleOutDepotBill='{1}'
  280. Set @Right = '{2}'
  281. select * From
  282. (
  283. SELECT SaleOutDepotBill.*,a.Name_User,b.Name_User as Name_UserAuti,c.Name_User as Name_LastModUser,
  284. Location.Name_Location,Location.No_Location,Customer.Name_Customer, Customer.ShortName_Customer,Customer.No_Customer
  285. FROM SaleOutDepotBill
  286. LEFT JOIN Customer ON Customer.ID_Customer = SaleOutDepotBill.ID_Customer
  287. LEFT JOIN AppUser a ON a.ID_User = SaleOutDepotBill.ID_Creator
  288. LEFT JOIN AppUser b ON b.ID_User = SaleOutDepotBill.ID_Assessor
  289. Left JOIN AppUser c ON c.ID_User = SaleOutDepotBill.LastModUser_SaleOutDepotBill
  290. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBill.ID_Location
  291. WHERE No_SaleOutDepotBill >= (case DataLength(@StartNo_SaleOutDepotBill)
  292. When 0 Then No_SaleOutDepotBill Else @StartNo_SaleOutDepotBill End) And No_SaleOutDepotBill <= (case DataLength(@EndNo_SaleOutDepotBill)
  293. When 0 Then No_SaleOutDepotBill Else @EndNo_SaleOutDepotBill End) and SaleOutDepotBill.Disable_SaleOutDepotBill=0
  294. )A
  295. Left Join
  296. (
  297. SELECT SaleOutDepotBill.No_SaleOutDepotBill as No_SaleOutDepotBill1,SaleOutDepotBillProduct.*,
  298. BillType.Name_BillType as Name_FromBill,
  299. UnitPrice_SaleBillProduct = Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End,
  300. convert(decimal(18,2),SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct * (Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End)) as money,
  301. Product.No_Product,Product.Name_Product,
  302. Product.Unit_Product as Unit_Product1 ,Location.Name_location as Name_location1
  303. ,SaleBill.No_SaleBill,SaleBill.No_OrderBill,SaleBill.Name_Linkman,SaleBill.SendAddr_SaleBill,SaleBill.Tel_SaleBill,
  304. SaleBill.OutStatus_SaleBill
  305. ,SaleBill.TaxCurrency_SaleBill,SaleBill.Currency_SaleBill
  306. FROM SaleOutDepotBillProduct
  307. LEFT JOIN BillType ON BillType.Value_BillType=SaleOutDepotBillProduct.Type_FromBill
  308. LEFT JOIN Product ON SaleOutDepotBillProduct.ID_Product=Product.ID_Product
  309. LEFT JOIN Location ON Location.ID_Location = SaleOutDepotBillProduct.ID_Location
  310. LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill= SaleOutDepotBillProduct.ID_SaleOutDepotBill
  311. Left Join
  312. (
  313. select SaleBill.No_SaleBill,SaleBill.No_OrderBill,SaleBill.Name_Linkman,SaleBill.SendAddr_SaleBill,SaleBill.
  314. Tel_SaleBill,SaleBill.OutStatus_SaleBill,SaleBill.TaxCurrency_SaleBill,SaleBill.Currency_SaleBill,
  315. UnitPrice_SaleBillProduct = Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End,SaleBillProduct.No_SaleBillProduct
  316. from SaleBill
  317. left join SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  318. ) SaleBill ON SaleBill.No_SaleBill= SaleOutDepotBillProduct.No_FromBill
  319. and SaleBill.No_SaleBillProduct=SaleOutDepotBillProduct.No_FromBillProduct
  320. WHERE No_SaleOutDepotBill >= (case DataLength(@StartNo_SaleOutDepotBill)
  321. When 0 Then No_SaleOutDepotBill Else @StartNo_SaleOutDepotBill End) And No_SaleOutDepotBill <= (case DataLength(@EndNo_SaleOutDepotBill)
  322. When 0 Then No_SaleOutDepotBill Else @EndNo_SaleOutDepotBill End)and SaleOutDepotBill.Disable_SaleOutDepotBill=0
  323. ) B On A.No_SaleOutDepotBill=B.No_SaleOutDepotBill1
  324. order by Name_Location1
  325. SELECT ReportComment.*,No_SaleOutDepotBill
  326. FROM ReportComment
  327. LEFT JOIN SaleOutDepotBill ON SaleOutDepotBill.ID_SaleOutDepotBill=ReportComment.ID_Bill
  328. WHERE No_SaleOutDepotBill >= (case DataLength(@StartNo_SaleOutDepotBill) When 0 Then No_SaleOutDepotBill
  329. Else @StartNo_SaleOutDepotBill End) And No_SaleOutDepotBill <= (case DataLength(@EndNo_SaleOutDepotBill)
  330. When 0 Then No_SaleOutDepotBill Else @EndNo_SaleOutDepotBill End)
  331. AND Disable_SaleOutDepotBill=0
  332. ORDER BY ReportComment.No_ReportComment
  333. declare @cessIn decimal(14,4)
  334. Select @cessIn=CessIn_SystemSetting From SystemSetting
  335. select SaleBill.No_SaleBill,SaleOutDepotBill.No_SaleOutDepotBill,
  336. GoodsAmount_SaleOutDepotBill = case SaleBill.TaxCurrency_SaleBill
  337. When '内含' Then sum((SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct*(Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End))/(1+@cessIn/100))
  338. else SUM((SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct*(Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End))) end,
  339. TaxAmount_SaleOutDepotBill = case SaleBill.TaxCurrency_SaleBill
  340. When '外加' Then SUM((SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct*(Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End))*(@cessIn)/100)
  341. When '内含' Then SUM((SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct*(Case @Right When 'False' Then 0 Else UnitPrice_SaleBillProduct End))*((@cessIn)/100)/(1+@cessIn/100))
  342. When '零税' Then 0
  343. When '免税' Then 0 end
  344. from SaleBill
  345. left join SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  346. left join SaleOutDepotBillProduct on SaleBill.No_SaleBill= SaleOutDepotBillProduct.No_FromBill and SaleBillProduct.No_SaleBillProduct=SaleOutDepotBillProduct.No_FromBillProduct
  347. left join SaleOutDepotBill on SaleOutDepotBillProduct.ID_SaleOutDepotBill=SaleOutDepotBill.ID_SaleOutDepotBill
  348. WHERE No_SaleOutDepotBill >= (case DataLength(@StartNo_SaleOutDepotBill) When 0 Then No_SaleOutDepotBill Else @StartNo_SaleOutDepotBill End) And No_SaleOutDepotBill <= (case DataLength(@EndNo_SaleOutDepotBill) When 0 Then No_SaleOutDepotBill Else @EndNo_SaleOutDepotBill End)
  349. AND Disable_SaleOutDepotBill=0
  350. group by SaleBill.No_SaleBill,SaleOutDepotBill.No_SaleOutDepotBill,SaleBill.TaxCurrency_SaleBill
  351. ]]>
  352. </SqlText>
  353. <TableName>SaleOutDepotBill,ReportComment,SaleBill</TableName>
  354. </PrintSql>
  355. <PrintSql>
  356. <FormName>FrmInventoryChangeBill</FormName>
  357. <SqlText>
  358. <![CDATA[
  359. Declare @StartNo_ModifyDepotBill nvarchar(64)
  360. Declare @EndNo_ModifyDepotBill nvarchar(64)
  361. Declare @Right NVARCHAR(64);
  362. Set @StartNo_ModifyDepotBill='{0}'
  363. Set @EndNo_ModifyDepotBill='{1}'
  364. Set @Right = '{2}'
  365. SELECT M.*,
  366. L.Name_Location AS ChangedDepot_ModifyDepotBill,
  367. L.No_Location AS ChangedDepotNo_ModifyDepotBill,
  368. MD.ModName_ModifyTypeSettings AS ModifyDepotBill_ModifyDepotBill,
  369. E.Name_Employee AS Proposer_ModifyDepotBill,
  370. E.No_Employee AS ProposerNo_ModifyDepotBill,
  371. A.Name_User AS Maker_ModifyDepotBill,
  372. A1.Name_User AS Assessor_ModifyDepotBill,
  373. A2.Name_User AS lastModflyuser_ModifyDepotBill,
  374. B.Sum_ModifyDepotBill
  375. FROM ModifyDepotBill M
  376. INNER JOIN LOCATION L ON M.ID_Location = L.ID_Location
  377. LEFT JOIN ModifyTypeSettings MD ON MD.ID_ModifyTypeSettings = M.Style_ModifyDepotBill
  378. INNER JOIN Employee E ON E.ID_Employee = M.ID_Proposer
  379. INNER JOIN AppUser A ON A.ID_User = M.ID_Creator
  380. LEFT JOIN AppUser A1 ON A1.ID_User = M.ID_Assessor
  381. LEFT JOIN AppUser A2 ON A2.ID_User = M.LastModUser_ModifyDepotBill
  382. Left Join (
  383. Select ID_ModifyDepotBill,SUM(Quantity_ModifyDepotBillProduct) As Sum_ModifyDepotBill
  384. From ModifyDepotBillProduct
  385. Group By ID_ModifyDepotBill )B On B.ID_ModifyDepotBill=M.ID_ModifyDepotBill
  386. WHERE No_ModifyDepotBill >= (case DataLength(@StartNo_ModifyDepotBill) When 0 Then No_ModifyDepotBill Else @StartNo_ModifyDepotBill End) And No_ModifyDepotBill <= (case DataLength(@EndNo_ModifyDepotBill) When 0 Then No_ModifyDepotBill Else @EndNo_ModifyDepotBill End)
  387. SELECT ModifyDepotBill.No_ModifyDepotBill,MS.Name_BillType AS SourceBillName_ModifyDepotBillProduct,
  388. No_ModifyDepotBillProduct,Type_FromBill,No_FromBill,No_FromBillProduct,Quantity_ModifyDepotBillProduct,
  389. UnitPrice_ModifyDepotBillProduct = Case @Right When 'false' Then 0 Else UnitPrice_ModifyDepotBillProduct End,Comment_ModifyDepotBillProduct,
  390. (Case @Right When 'false' Then 0 Else UnitPrice_ModifyDepotBillProduct End)*MP.Quantity_ModifyDepotBillProduct AS ProductMoney_FromBillProduct,
  391. P.No_Product AS ProductNo_FromBillProduct,
  392. P.Name_Product AS ProductName_FromBillProduct,
  393. P.Unit_Product AS ProductUnit_FromBillProduct,
  394. L.Name_Location AS Location_FromBillProduct
  395. FROM ModifyDepotBillProduct MP
  396. Left JOIN Product P ON P.ID_Product = MP.ID_Product
  397. INNER JOIN Location L ON L.ID_Location = MP.ID_Location
  398. LEFT JOIN BillType MS ON MS.Value_BillType = MP.Type_FromBill
  399. Left Join ModifyDepotBill On ModifyDepotBill.ID_ModifyDepotBill=MP.ID_ModifyDepotBill
  400. WHERE No_ModifyDepotBill >= (case DataLength(@StartNo_ModifyDepotBill) When 0 Then No_ModifyDepotBill Else @StartNo_ModifyDepotBill End) And No_ModifyDepotBill <= (case DataLength(@EndNo_ModifyDepotBill) When 0 Then No_ModifyDepotBill Else @EndNo_ModifyDepotBill End)
  401. Order By CAST(MP.No_ModifyDepotBillProduct AS INT)
  402. ]]>
  403. </SqlText>
  404. <TableName>ModifyDepotBill,ModifyDepotBillProduct</TableName>
  405. </PrintSql>
  406. <PrintSql>
  407. <FormName>FrmStocktakingBill</FormName>
  408. <SqlText>
  409. <![CDATA[
  410. Declare @StartNo_StocktakingBill nvarchar(64)
  411. Declare @EndNo_StocktakingBill nvarchar(64)
  412. Declare @Right nvarchar(64)
  413. Set @StartNo_StocktakingBill='{0}'
  414. Set @EndNo_StocktakingBill='{1}'
  415. Set @Right = '{2}'
  416. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  417. Location.No_Location, Location.Name_Location
  418. FROM StocktakingBill
  419. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  420. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  421. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  422. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  423. WHERE No_StocktakingBill >= (case DataLength(@StartNo_StocktakingBill) When 0 Then No_StocktakingBill Else @StartNo_StocktakingBill End) And No_StocktakingBill <= (case DataLength(@EndNo_StocktakingBill) When 0 Then No_StocktakingBill Else @EndNo_StocktakingBill End)
  424. SELECT No_StocktakingBillProduct,StockQty_StocktakingBillProduct,Quantity_StocktakingBillProduct,UnitPrice_StocktakingBillProduct = Case @Right When 'False' Then 0 Else UnitPrice_StocktakingBillProduct End,Comment_StocktakingBillProduct,
  425. convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  426. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  427. Location.No_Location, Location.Name_Location,No_StocktakingBill
  428. FROM StocktakingBillProduct
  429. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  430. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  431. LEFT JOIN StocktakingBill ON StocktakingBillProduct.ID_StocktakingBill = StocktakingBill.ID_StocktakingBill
  432. WHERE No_StocktakingBill >= (case DataLength(@StartNo_StocktakingBill) When 0 Then No_StocktakingBill Else @StartNo_StocktakingBill End) And No_StocktakingBill <= (case DataLength(@EndNo_StocktakingBill) When 0 Then No_StocktakingBill Else @EndNo_StocktakingBill End)
  433. And (Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct)!=0
  434. order by CAST(No_StocktakingBillProduct AS INT)
  435. ]]>
  436. </SqlText>
  437. <TableName>StocktakingBill,StocktakingBillProduct</TableName>
  438. </PrintSql>
  439. <PrintSql>
  440. <FormName>FrmSaleInvoicce</FormName>
  441. <SqlText>
  442. <![CDATA[
  443. Declare @StartNo nvarchar(64)
  444. Declare @EndNo nvarchar(64)
  445. Set @StartNo='{0}'
  446. Set @EndNo='{1}'
  447. SELECT SaleInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Customer.No_Customer,Customer.ShortName_Customer,Customer.RevenueRegisterNo_Customer,Customer.Bank_Customer,Customer.Account_Customer,Customer.GetMethod_Customer,TypeName=CASE Type_SaleInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  448. FROM SaleInvoice
  449. LEFT JOIN AppUser a ON SaleInvoice.ID_Creator=a.ID_User
  450. LEFT JOIN AppUser b ON SaleInvoice.ID_Assessor=b.ID_User
  451. LEFT JOIN AppUser c ON SaleInvoice.LastModUser_SaleInvoice=c.ID_User
  452. Left JOIN Customer On Customer.ID_Customer=SaleInvoice.ID_Customer
  453. WHERE No_SaleInvoice >= (case DataLength(@StartNo) When 0 Then No_SaleInvoice Else @StartNo End) And No_SaleInvoice <= (case DataLength(@EndNo) When 0 Then No_SaleInvoice Else @EndNo End)
  454. SELECT SaleInvoiceProduct.*,SaleInvoiceProduct.Quantity_SaleInvoiceProduct*SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct As Money,
  455. SaleInvoiceProduct.Quantity_SaleInvoiceProduct*SaleInvoiceProduct.UnitPrice_SaleInvoiceProduct*SaleInvoiceProduct.TaxRate_SaleInvoiceProduct As TaxMoney,
  456. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType,SaleInvoice.No_SaleInvoice
  457. FROM SaleInvoiceProduct
  458. LEFT JOIN Product On Product.ID_Product=SaleInvoiceProduct.ID_Product
  459. LEFT JOIN SaleInvoice On SaleInvoice.ID_SaleInvoice=SaleInvoiceProduct.ID_SaleInvoice
  460. LEFT JOIN BillType On BillType.Value_BillType=SaleInvoiceProduct.Type_FromBill
  461. WHERE No_SaleInvoice >= (case DataLength(@StartNo) When 0 Then No_SaleInvoice Else @StartNo End) And No_SaleInvoice <= (case DataLength(@EndNo) When 0 Then No_SaleInvoice Else @EndNo End)
  462. ]]>
  463. </SqlText>
  464. <TableName>SaleInvoice,SaleInvoiceProduct</TableName>
  465. </PrintSql>
  466. <PrintSql>
  467. <FormName>FrmPurchaseInvoice</FormName>
  468. <SqlText>
  469. <![CDATA[
  470. Declare @StartNo nvarchar(64)
  471. Declare @EndNo nvarchar(64)
  472. Set @StartNo='{0}'
  473. Set @EndNo='{1}'
  474. SELECT PurchaseInvoice.*,a.Name_User As Creator ,b.Name_User As Assessor,c.Name_User As LastModUser,Supplier.No_Supplier,Supplier.ShortName_Supplier,TypeName=CASE Type_PurchaseInvoice When 0 Then '普通发票' ELSE '增值税发票' End
  475. FROM PurchaseInvoice
  476. LEFT JOIN AppUser a ON PurchaseInvoice.ID_Creator=a.ID_User
  477. LEFT JOIN AppUser b ON PurchaseInvoice.ID_Assessor=b.ID_User
  478. LEFT JOIN AppUser c ON PurchaseInvoice.LastModUser_PurchaseInvoice=c.ID_User
  479. Left JOIN Supplier On Supplier.ID_Supplier=PurchaseInvoice.ID_Supplier
  480. WHERE No_PurchaseInvoice >= (case DataLength(@StartNo) When 0 Then No_PurchaseInvoice Else @StartNo End) And No_PurchaseInvoice <= (case DataLength(@EndNo) When 0 Then No_PurchaseInvoice Else @EndNo End)
  481. SELECT PurchaseInvoiceProduct.*,No_PurchaseInvoice,PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct As Money,
  482. PurchaseInvoiceProduct.Quantity_PurchaseInvoiceProduct*PurchaseInvoiceProduct.UnitPrice_PurchaseInvoiceProduct*PurchaseInvoiceProduct.TaxRate_PurchaseInvoiceProduct As TaxMoney,
  483. Product.No_Product,Product.Name_Product,Product.InvoiceName_Product,Product.Unit_Product,BillType.Name_BillType
  484. FROM PurchaseInvoiceProduct
  485. LEFT JOIN Product On Product.ID_Product=PurchaseInvoiceProduct.ID_Product
  486. LEFT JOIN PurchaseInvoice On PurchaseInvoice.ID_PurchaseInvoice=PurchaseInvoiceProduct.ID_PurchaseInvoice
  487. LEFT JOIN BillType On BillType.Value_BillType=PurchaseInvoiceProduct.Type_FromBill
  488. WHERE No_PurchaseInvoice >= (case DataLength(@StartNo) When 0 Then No_PurchaseInvoice Else @StartNo End) And No_PurchaseInvoice <= (case DataLength(@EndNo) When 0 Then No_PurchaseInvoice Else @EndNo End)
  489. ]]>
  490. </SqlText>
  491. <TableName>PurchaseInvoice,PurchaseInvoiceProduct</TableName>
  492. </PrintSql>
  493. <PrintSql>
  494. <FormName>FrmIndentBillOnNet</FormName>
  495. <SqlText>
  496. <![CDATA[
  497. Declare @StartNo nvarchar(64)
  498. Declare @EndNo nvarchar(64)
  499. Set @StartNo='{0}'
  500. Set @EndNo='{1}'
  501. SELECT IndentBillOnNet.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer, Customer.Type_Customer,
  502. Customer.LastDiscount_Customer, Customer.PostalCode_Customer, ISNULL(b.Name_User, '') AS Name_Assessor, Customer.ID_Creator As CustomerCreator
  503. FROM IndentBillOnNet
  504. LEFT JOIN Customer ON Customer.ID_Customer = IndentBillOnNet.ID_Customer
  505. LEFT JOIN AppUser b ON b.ID_User = IndentBillOnNet.ID_Assessor
  506. WHERE No_IndentBillOnNet >= (case DataLength(@StartNo) When 0 Then No_IndentBillOnNet Else @StartNo End) And No_IndentBillOnNet <= (case DataLength(@EndNo) When 0 Then No_IndentBillOnNet Else @EndNo End)
  507. SELECT IndentBillOnNetProduct.*,No_IndentBillOnNet,Product.No_Product, Product.Name_Product, Product.Unit_Product,
  508. (IndentBillOnNetProduct.Quantity_IndentBillOnNetProduct * IndentBillOnNetProduct.UnitPrice_IndentBillOnNetProduct) AS Amount_IndentBillOnNetProduct ,@No_IndentBillOnNet as No_IndentBillOnNet
  509. FROM IndentBillOnNetProduct
  510. LEFT JOIN Product ON Product.ID_Product = IndentBillOnNetProduct.ID_Product
  511. Left Join IndentBillOnNet On IndentBillOnNet.ID_IndentBillOnNet=IndentBillOnNet.IndentBillOnNet
  512. WHERE No_IndentBillOnNet >= (case DataLength(@StartNo) When 0 Then No_IndentBillOnNet Else @StartNo End) And No_IndentBillOnNet <= (case DataLength(@EndNo) When 0 Then No_IndentBillOnNet Else @EndNo End)
  513. ]]>
  514. </SqlText>
  515. <TableName>IndentBillOnNet,IndentBillOnNetProduct</TableName>
  516. </PrintSql>
  517. </PrintSqlDataSet>