FrmUnStrikeInvoiceDetail.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmUnStrikeInvoiceDetail">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="未冲发票明细";
  9. GetSchema();
  10. txtCoNo.CValue=GetCurrentCompanyNo();
  11. txtCoName.CValue=GetCurrentCompanyShortName();
  12. Empty();
  13. NewInstance();
  14. ComboCompany.Enabled = false;
  15. dtEnd.Enabled = false;
  16. ]]>
  17. </Load>
  18. <Closing>
  19. ;
  20. </Closing>
  21. <Closed>
  22. ;
  23. </Closed>
  24. </Events>
  25. <Mode>
  26. <Search>
  27. <Lable name="Search"/>
  28. </Search>
  29. </Mode>
  30. <Controls>
  31. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  32. <Events>
  33. <Click>
  34. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  35. if( @temp == "" )
  36. return;
  37. tbCustomerNo1.CValue = @temp;
  38. </Click>
  39. <TextBoxButtonTextChanged>
  40. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  41. </TextBoxButtonTextChanged>
  42. </Events>
  43. </IKTextButton>
  44. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  45. <Events>
  46. <Click>
  47. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  48. if( @temp == "" )
  49. return;
  50. tbCustomerNo2.CValue = @temp;
  51. </Click>
  52. </Events>
  53. </IKTextButton>
  54. <IKCheckBox name="ikCheckCompany" DataSource="UI.Company_Flag">
  55. <Events>
  56. <CheckedChanged>
  57. ComboCompany.Enabled = !ComboCompany.Enabled;
  58. </CheckedChanged>
  59. </Events>
  60. </IKCheckBox>
  61. <IKComboBoxEx name="ComboCompany" DisplaySource="UI.Company_Name" DataSource="CompanyType" DisplayMember="Name_TypeDef" >
  62. <Events>
  63. <Reload>
  64. UpdateForm(false, "ComboCompany");
  65. Search("SearchCompany");
  66. UpdateForm(true, "ComboCompany");
  67. </Reload>
  68. </Events>
  69. </IKComboBoxEx>
  70. <IKCheckBox name="ikCheckEndDate">
  71. <Events>
  72. <CheckedChanged>
  73. dtEnd.Enabled = !dtEnd.Enabled;
  74. dtEnd.Checked = true;
  75. </CheckedChanged>
  76. </Events>
  77. </IKCheckBox>
  78. <IKDateTimePicker name = "dtEnd">
  79. </IKDateTimePicker>
  80. <IKButton name="btnView">
  81. <Events>
  82. <Click>
  83. <!--UpdateForm(false,"");-->
  84. @StartNo_Customer = "";
  85. @EndNo_Customer = "";
  86. @Company_Name = "";
  87. if(tbCustomerNo1.CValue == "")
  88. {
  89. MessageBox("请输入客户编号");
  90. return;
  91. }
  92. if(tbCustomerNo1.CValue != "")
  93. @StartNo_Customer = tbCustomerNo1.CValue;
  94. if(tbCustomerNo2.CValue != "")
  95. @EndNo_Customer = tbCustomerNo2.CValue;
  96. if( ikCheckCompany.Checked )
  97. {
  98. if (ComboCompany.Text !="")
  99. {
  100. #UI.company_Name = ComboCompany.Text;
  101. @Company_Name = ComboCompany.Text;
  102. }
  103. else
  104. {
  105. MessageBox("请选泽所属公司!!");
  106. #UI.company_Name = "";
  107. @Company_Name = "";
  108. return;
  109. }
  110. }
  111. else
  112. {
  113. #UI.company_Name = "";
  114. @Company_Name = "";
  115. }
  116. Search("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
  117. if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
  118. {
  119. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  120. }
  121. else
  122. {
  123. PrintReport("UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
  124. }
  125. </Click>
  126. </Events>
  127. </IKButton>
  128. <IKButton name="btnExcel">
  129. <Events>
  130. <Click>
  131. <!--UpdateForm(false,"");-->
  132. @StartNo_Customer = "";
  133. @EndNo_Customer = "";
  134. @Company_Name = "";
  135. if(tbCustomerNo1.CValue != "")
  136. @StartNo_Customer = tbCustomerNo1.CValue;
  137. if(tbCustomerNo2.CValue != "")
  138. @EndNo_Customer = tbCustomerNo2.CValue;
  139. if( ikCheckCompany.Checked ){
  140. if (ComboCompany.Text !=""){
  141. #UI.company_Name = ComboCompany.Text;
  142. @Company_Name = ComboCompany.Text;
  143. }else{
  144. MessageBox("请选泽所属公司!!");
  145. #UI.company_Name = "";
  146. @Company_Name = "";
  147. return;
  148. }
  149. } else {
  150. #UI.company_Name = "";
  151. @Company_Name = "";
  152. }
  153. Search("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
  154. if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
  155. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  156. else
  157. ExportReport("Excel","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
  158. </Click>
  159. </Events>
  160. </IKButton>
  161. <IKButton name="btnWord">
  162. <Events>
  163. <Click>
  164. <!--UpdateForm(false,"");-->
  165. @StartNo_Customer = "";
  166. @EndNo_Customer = "";
  167. @Company_Name = "";
  168. if(tbCustomerNo1.CValue != "")
  169. @StartNo_Customer = tbCustomerNo1.CValue;
  170. if(tbCustomerNo2.CValue != "")
  171. @EndNo_Customer = tbCustomerNo2.CValue;
  172. if( ikCheckCompany.Checked ){
  173. if (ComboCompany.Text !=""){
  174. #UI.company_Name = ComboCompany.Text;
  175. @Company_Name = ComboCompany.Text;
  176. }else{
  177. MessageBox("请选泽所属公司!!");
  178. #UI.company_Name = "";
  179. @Company_Name = "";
  180. return;
  181. }
  182. } else {
  183. #UI.company_Name = "";
  184. @Company_Name = "";
  185. }
  186. Search("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
  187. if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
  188. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  189. else
  190. ExportReport("Word","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
  191. </Click>
  192. </Events>
  193. </IKButton>
  194. <IKButton name="btnPrint">
  195. <Events>
  196. <Click>
  197. <!--UpdateForm(false,"");-->
  198. @StartNo_Customer = "";
  199. @EndNo_Customer = "";
  200. @Company_Name = "";
  201. if(tbCustomerNo1.CValue != "")
  202. @StartNo_Customer = tbCustomerNo1.CValue;
  203. if(tbCustomerNo2.CValue != "")
  204. @EndNo_Customer = tbCustomerNo2.CValue;
  205. if( ikCheckCompany.Checked ){
  206. if (ComboCompany.Text !=""){
  207. #UI.company_Name = ComboCompany.Text;
  208. @Company_Name = ComboCompany.Text;
  209. }else{
  210. MessageBox("请选泽所属公司!!");
  211. #UI.company_Name = "";
  212. @Company_Name = "";
  213. return;
  214. }
  215. } else {
  216. #UI.company_Name = "";
  217. @Company_Name = "";
  218. }
  219. Search("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
  220. if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
  221. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  222. else
  223. ExportReport("PrintToPrinter","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
  224. </Click>
  225. </Events>
  226. </IKButton>
  227. </Controls>
  228. <ChildForms>
  229. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  230. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  231. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  232. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  233. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  234. </ChildForm>
  235. </ChildForms>
  236. <FormatString>
  237. <Format name="SearchCustomerCondition">
  238. if(GetRight("客户基本资料","全权查看"))
  239. {
  240. FormatString("");
  241. }
  242. else
  243. {
  244. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  245. }
  246. </Format>
  247. </FormatString>
  248. </Client>
  249. <Server>
  250. <Tables>
  251. <Table name="UI" Type="Parent">
  252. <GetSchema CmdType="Text" CmdText=" Select TOP 0 convert(nvarchar(32),'') As StartNo_Customer
  253. ,convert(nvarchar(32),'') As EndNo_Customer
  254. ,convert(nvarchar(32),'') As Company_Name
  255. ,convert(bit,'false') As Company_Flag
  256. "/>
  257. </Table>
  258. </Tables>
  259. <Search>
  260. <SearchAllCustomer CmdType="Text" CmdText=" SELECT Customer.No_Customer
  261. ,Customer.ShortName_Customer
  262. ,Customer.Type_Customer
  263. ,Customer.Level_Customer
  264. ,Customer.IsGeneric_Customer
  265. ,Customer.Note_Customer
  266. FROM Customer
  267. ">
  268. <Tables>
  269. <Table name="AllCustomer" />
  270. </Tables>
  271. </SearchAllCustomer>
  272. <SearchCompany CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 30">
  273. <Tables>
  274. <Table name="CompanyType"/>
  275. </Tables>
  276. </SearchCompany>
  277. <SearchUnStrikeInvoiceDetail CmdType="Text" CmdText="
  278. declare @tempTable table
  279. (
  280. [No_Customer] nvarchar(32)
  281. ,[ShortName_Customer] nvarchar(32)
  282. ,[Company_Customer] nvarchar(32)
  283. ,[BillPregetMoney] decimal (14,6)
  284. ,[BillTogetMoney] decimal (14,6)
  285. ,[BillType] nvarchar(32)
  286. ,[BillNo] nvarchar(32)
  287. ,[BillDate] datetime
  288. ,[BillStrikeMoney] decimal (14,6)
  289. ,[BillUnStrikeMoney] decimal (14,6)
  290. )
  291. declare @CustomerID uniqueidentifier
  292. declare cur cursor for select ID_Customer from Customer where No_Customer = @StartNo_Customer
  293. open cur
  294. fetch next from cur into @CustomerID
  295. while @@fetch_status = 0
  296. begin
  297. insert into @tempTable
  298. select No_Customer , ShortName_Customer , '' as [Company_Customer] , 0 as [BillPregetMoney], 0 as [BillTogetMoney] , '期初应收款' as BillType , '' as BillNo ,
  299. CreateDate_Customer as BillDate ,
  300. abs(isnull([OpeningToGetBalance_Customer],0)) as BillStrikeMoney,
  301. abs(abs(isnull([OpeningToGetBalance_Customer],0)) - abs(isnull([OpenningBalance_Customer],0))) as BillUnStrikeMoney
  302. from Customer
  303. where abs(abs(isnull([OpeningToGetBalance_Customer],0)) - abs(isnull([OpenningBalance_Customer],0))) &lt;&gt; 0
  304. and ID_Customer = @CustomerID
  305. union all
  306. select No_Customer , ShortName_Customer , Company_SaleInvoice as [Company_Customer], 0 as [BillPregetMoney], 0 as [BillTogetMoney] , '发票' as BillType , No_SaleInvoice as BillNo ,
  307. Date_SaleInvoice as BillDate ,
  308. isnull([Amount_SaleInvoice],0) as BillStrikeMoney,
  309. isnull([Amount_SaleInvoice],0)-isnull([StrikedAmount_SaleInvoice],0) as BillUnStrikeMoney
  310. from SaleInvoice , Customer
  311. where SaleInvoice.ID_Customer = Customer.ID_Customer
  312. and isnull([Amount_SaleInvoice],0)-isnull([StrikedAmount_SaleInvoice],0) &lt;&gt; 0
  313. and Disable_SaleInvoice = 0
  314. and ID_Assessor is not null
  315. and Customer.ID_Customer = @CustomerID
  316. and (@Company_Name = '' or @Company_Name is null or Company_SaleInvoice = @Company_Name)
  317. fetch next from cur into @CustomerID
  318. end
  319. select * from @tempTable
  320. close cur
  321. deallocate cur
  322. ">
  323. <Params>
  324. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="0" />
  325. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="1" />
  326. <Param name="@Company_Name" type="Customer.No_Customer" Index="2" />
  327. </Params>
  328. <Tables>
  329. <Table name="FrmUnStrikeInvoiceDetail"/>
  330. </Tables>
  331. </SearchUnStrikeInvoiceDetail>
  332. <SearchSaleInvoice CmdType="Text" CmdText=" Declare @ID_Customer uniqueidentifier
  333. Select @ID_Customer =ID_customer From Customer
  334. Where No_Customer=@No_Customer
  335. Declare @Customer Table(ID_Customer Uniqueidentifier)
  336. Insert Into @Customer Values(@ID_Customer)
  337. Insert Into @Customer
  338. Select ID_Customer
  339. From Customer
  340. Where CustomerID_Customer = @ID_Customer
  341. Select No_SaleInvoice
  342. From SaleInvoice
  343. Where ID_Customer in (Select ID_Customer From @Customer)
  344. And ID_Assessor is not null
  345. And Amount_saleinvoice &gt; StrikedAmount_SaleInvoice + DisCountAmount_SaleInvoice
  346. And PayDate_SaleInvoice &lt; @AssessDate_SaleBill
  347. And Disable_SaleInvoice = 0
  348. ">
  349. <Params>
  350. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  351. <Param name="@AssessDate_SaleBill" type="SaleBill.AssessDate_SaleBill" Index="1" />
  352. </Params>
  353. <Tables>
  354. <Table name="SearchSaleInvoice" />
  355. </Tables>
  356. </SearchSaleInvoice>
  357. <SearchIsMainCustomer CmdType="Text" CmdText="
  358. declare @ID uniqueidentifier
  359. declare @Count int
  360. select @Count = 0
  361. select @Count = Count(1) from Customer where No_Customer = @No
  362. select @ID = CustomerID_Customer from Customer where No_Customer = @No
  363. if @Count &lt;&gt; 0 and (@ID is null or @ID = '00000000-0000-0000-0000-000000000000')
  364. select 1
  365. else
  366. select * from Customer where 1 = 2
  367. ">
  368. <Params>
  369. <Param name="@No" type="Customer.No_Customer" Index="0" />
  370. </Params>
  371. <Tables>
  372. <Table name="SearchIsMainCustomerTemp"/>
  373. </Tables>
  374. </SearchIsMainCustomer>
  375. </Search>
  376. </Server>
  377. </Form>
  378. </Forms>