FrmReceivableStrikeDetails.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmReceivableStrikeDetails">
  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. #UI.StartDate = GetCurrentTime();
  15. #UI.EndDate = GetCurrentTime();
  16. ComboCompany.Enabled = false;
  17. ]]>
  18. </Load>
  19. <Closing>
  20. ;
  21. </Closing>
  22. <Closed>
  23. ;
  24. </Closed>
  25. </Events>
  26. <Mode>
  27. <Search>
  28. <Lable name="Search"/>
  29. </Search>
  30. </Mode>
  31. <Controls>
  32. <IKDateTimePicker name="dtStart" DataSource="UI.StartDate">
  33. <Events>
  34. <CheckedChanged>
  35. dtEnd.Checked = dtStart.Checked;
  36. </CheckedChanged>
  37. <ValueChanged>
  38. dtEnd.CValue = dtStart.CValue;
  39. </ValueChanged>
  40. </Events>
  41. </IKDateTimePicker>
  42. <IKDateTimePicker name="dtEnd" DataSource="UI.EndDate"/>
  43. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  44. <Events>
  45. <Click>
  46. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  47. if( @temp == "" )
  48. return;
  49. tbCustomerNo1.CValue = @temp;
  50. </Click>
  51. <TextBoxButtonTextChanged>
  52. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  53. </TextBoxButtonTextChanged>
  54. </Events>
  55. </IKTextButton>
  56. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  57. <Events>
  58. <Click>
  59. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  60. if( @temp == "" )
  61. return;
  62. tbCustomerNo2.CValue = @temp;
  63. </Click>
  64. </Events>
  65. </IKTextButton>
  66. <IKCheckBox name="ikCheckCompany" DataSource="UI.Company_Flag">
  67. <Events>
  68. <CheckedChanged>
  69. ComboCompany.Enabled = !ComboCompany.Enabled;
  70. </CheckedChanged>
  71. </Events>
  72. </IKCheckBox>
  73. <IKComboBoxEx name="ComboCompany" DisplaySource="UI.Company_Name" DataSource="CompanyType" DisplayMember="Name_TypeDef" >
  74. <Events>
  75. <Reload>
  76. UpdateForm(false, "ComboCompany");
  77. Search("SearchCompany");
  78. UpdateForm(true, "ComboCompany");
  79. </Reload>
  80. </Events>
  81. </IKComboBoxEx>
  82. <IKButton name="btnView">
  83. <Events>
  84. <Click>
  85. UpdateForm(false,"");
  86. @StartDate=DBNull();
  87. @EndDate=DBNull();
  88. @StartNo_Customer = DBNull();
  89. @EndNo_Customer = DBNull();
  90. @Company_Name = "";
  91. if(dtStart.Checked)
  92. {
  93. @StartDate=dtStart.Value;
  94. }
  95. else
  96. {
  97. MessageBox("统计期间必填!",@Title);
  98. return;
  99. }
  100. if(dtEnd.Checked)
  101. {
  102. @EndDate=dtEnd.Value;
  103. }
  104. else
  105. {
  106. MessageBox("统计期间必填!",@Title);
  107. return;
  108. }
  109. if(tbCustomerNo1.CValue != "")
  110. @StartNo_Customer = tbCustomerNo1.CValue;
  111. if(tbCustomerNo2.CValue != "")
  112. @EndNo_Customer = tbCustomerNo2.CValue;
  113. if( ikCheckCompany.Checked ){
  114. if (ComboCompany.Text !=""){
  115. #UI.company_Name = ComboCompany.Text;
  116. @Company_Name = ComboCompany.Text;
  117. }else{
  118. MessageBox("请选泽所属公司!!");
  119. #UI.company_Name = "";
  120. @Company_Name = "";
  121. return;
  122. }
  123. } else {
  124. #UI.company_Name = "";
  125. @Company_Name = "";
  126. }
  127. Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
  128. if(RowCount("#FrmReceivableStrikeDetails")==0)
  129. {
  130. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  131. }
  132. else
  133. {
  134. PrintReport("UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
  135. }
  136. </Click>
  137. </Events>
  138. </IKButton>
  139. <IKButton name="btnExcel">
  140. <Events>
  141. <Click>
  142. UpdateForm(false,"");
  143. @StartDate=DBNull();
  144. @EndDate=DBNull();
  145. @StartNo_Customer = DBNull();
  146. @EndNo_Customer = DBNull();
  147. @Company_Name = "";
  148. if(dtStart.Checked)
  149. {
  150. @StartDate=dtStart.Value;
  151. }
  152. else
  153. {
  154. MessageBox("统计期间必填!",@Title);
  155. return;
  156. }
  157. if(dtEnd.Checked)
  158. {
  159. @EndDate=dtEnd.Value;
  160. }
  161. else
  162. {
  163. MessageBox("统计期间必填!",@Title);
  164. return;
  165. }
  166. if(tbCustomerNo1.CValue != "")
  167. @StartNo_Customer = tbCustomerNo1.CValue;
  168. if(tbCustomerNo2.CValue != "")
  169. @EndNo_Customer = tbCustomerNo2.CValue;
  170. if( ikCheckCompany.Checked ){
  171. if (ComboCompany.Text !=""){
  172. #UI.company_Name = ComboCompany.Text;
  173. @Company_Name = ComboCompany.Text;
  174. }else{
  175. MessageBox("请选泽所属公司!!");
  176. #UI.company_Name = "";
  177. @Company_Name = "";
  178. return;
  179. }
  180. } else {
  181. #UI.company_Name = "";
  182. @Company_Name = "";
  183. }
  184. Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
  185. if(RowCount("#FrmReceivableStrikeDetails")==0)
  186. {
  187. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  188. }
  189. else
  190. {
  191. ExportReport("Excel","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
  192. }
  193. </Click>
  194. </Events>
  195. </IKButton>
  196. <IKButton name="btnWord">
  197. <Events>
  198. <Click>
  199. UpdateForm(false,"");
  200. @StartDate=DBNull();
  201. @EndDate=DBNull();
  202. @StartNo_Customer = DBNull();
  203. @EndNo_Customer = DBNull();
  204. @Company_Name = "";
  205. if(dtStart.Checked)
  206. {
  207. @StartDate=dtStart.Value;
  208. }
  209. else
  210. {
  211. MessageBox("统计期间必填!",@Title);
  212. return;
  213. }
  214. if(dtEnd.Checked)
  215. {
  216. @EndDate=dtEnd.Value;
  217. }
  218. else
  219. {
  220. MessageBox("统计期间必填!",@Title);
  221. return;
  222. }
  223. if(tbCustomerNo1.CValue != "")
  224. @StartNo_Customer = tbCustomerNo1.CValue;
  225. if(tbCustomerNo2.CValue != "")
  226. @EndNo_Customer = tbCustomerNo2.CValue;
  227. if( ikCheckCompany.Checked ){
  228. if (ComboCompany.Text !=""){
  229. #UI.company_Name = ComboCompany.Text;
  230. @Company_Name = ComboCompany.Text;
  231. }else{
  232. MessageBox("请选泽所属公司!!");
  233. #UI.company_Name = "";
  234. @Company_Name = "";
  235. return;
  236. }
  237. } else {
  238. #UI.company_Name = "";
  239. @Company_Name = "";
  240. }
  241. Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
  242. if(RowCount("#FrmReceivableStrikeDetails")==0)
  243. {
  244. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  245. }
  246. else
  247. {
  248. ExportReport("Word","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
  249. }
  250. </Click>
  251. </Events>
  252. </IKButton>
  253. <IKButton name="btnPrint">
  254. <Events>
  255. <Click>
  256. UpdateForm(false,"");
  257. @StartDate=DBNull();
  258. @EndDate=DBNull();
  259. @StartNo_Customer = DBNull();
  260. @EndNo_Customer = DBNull();
  261. @Company_Name = "";
  262. if(dtStart.Checked)
  263. {
  264. @StartDate=dtStart.Value;
  265. }
  266. else
  267. {
  268. MessageBox("统计期间必填!",@Title);
  269. return;
  270. }
  271. if(dtEnd.Checked)
  272. {
  273. @EndDate=dtEnd.Value;
  274. }
  275. else
  276. {
  277. MessageBox("统计期间必填!",@Title);
  278. return;
  279. }
  280. if(tbCustomerNo1.CValue != "")
  281. @StartNo_Customer = tbCustomerNo1.CValue;
  282. if(tbCustomerNo2.CValue != "")
  283. @EndNo_Customer = tbCustomerNo2.CValue;
  284. if( ikCheckCompany.Checked ){
  285. if (ComboCompany.Text !=""){
  286. #UI.company_Name = ComboCompany.Text;
  287. @Company_Name = ComboCompany.Text;
  288. }else{
  289. MessageBox("请选泽所属公司!!");
  290. #UI.company_Name = "";
  291. @Company_Name = "";
  292. return;
  293. }
  294. } else {
  295. #UI.company_Name = "";
  296. @Company_Name = "";
  297. }
  298. Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
  299. if(RowCount("#FrmReceivableStrikeDetails")==0)
  300. {
  301. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  302. }
  303. else
  304. {
  305. ExportReport("PrintToPrinter","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
  306. }
  307. </Click>
  308. </Events>
  309. </IKButton>
  310. </Controls>
  311. <ChildForms>
  312. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  313. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  314. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  315. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  316. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  317. </ChildForm>
  318. </ChildForms>
  319. <FormatString>
  320. <Format name="SearchCustomerCondition">
  321. if(GetRight("客户基本资料","全权查看"))
  322. {
  323. FormatString("");
  324. }
  325. else
  326. {
  327. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  328. }
  329. </Format>
  330. </FormatString>
  331. </Client>
  332. <Server>
  333. <Tables>
  334. <Table name="UI" Type="Parent">
  335. <GetSchema CmdType="Text" CmdText="Select TOP 0 convert(datetime,0) As StartDate
  336. ,convert(datetime,0) As EndDate
  337. ,convert(nvarchar(64),'') As StartNo_Customer
  338. ,convert(nvarchar(64),'') As EndNo_Customer
  339. ,convert(nvarchar(64),'') As Company_Name
  340. ,convert(bit,'false') As Company_Flag"/>
  341. </Table>
  342. </Tables>
  343. <Search>
  344. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer,Customer.Note_Customer FROM Customer ">
  345. <Tables>
  346. <Table name="AllCustomer" />
  347. </Tables>
  348. </SearchAllCustomer>
  349. <SearchCompany CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 30">
  350. <Tables>
  351. <Table name="CompanyType"/>
  352. </Tables>
  353. </SearchCompany>
  354. <SearchReceivableStrikeDetails CmdType="Text" CmdText=" declare @sqlCmd nvarchar(4000)
  355. set @sqlCmd=N' select * '
  356. +N' from '
  357. +N' ( '
  358. +N' Select No_Customer '
  359. +N' ,ShortName_Customer '
  360. +N' ,(case when (OpeningToGetBalance_Customer - OpeningPrepayBalance_Customer + IsNull(B.Big,0) - IsNull(C.Little,0)) = 0 then 0 '
  361. +N' else (OpeningToGetBalance_Customer - OpeningPrepayBalance_Customer + IsNull(B.Big,0) - IsNull(C.Little,0)) end )'
  362. +N' As ToGetMoney '
  363. +N' ,Note_Customer as PreNote'
  364. +N' ,'''+convert(nvarchar(64),@Company_Name)+N''' as Company'
  365. +N' From '
  366. +N' ( '
  367. +N' Select ID_Customer '
  368. +N' ,No_Customer '
  369. +N' ,ShortName_Customer '
  370. +N' ,OpeningPrePayBalance_Customer '
  371. +N' ,OpeningToGetBalance_Customer '
  372. +N' ,Note_Customer '
  373. +N' ,IsCustomersCustomer_Customer '
  374. +N' ,Company_Customer'
  375. +N' From Customer '
  376. +N' Where ID_Customer Is Not Null '
  377. +N' And IsCustomersCustomer_Customer = 0 '
  378. if(@StartNo_Customer Is Not Null)
  379. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  380. if(@EndNo_Customer Is Not Null)
  381. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  382. if(@Company_Name Is Not Null)
  383. if (@Company_Name!='')
  384. set @sqlCmd=@sqlCmd+N' And Company_Customer = '+nchar(39)+@Company_Name+nchar(39)
  385. set @sqlCmd=@sqlCmd+N' ) A '
  386. +N' Left Join '
  387. +N' ( '
  388. +N' Select ID_Customer,Sum(Amount_SaleInvoice) As Big '
  389. +N' From SaleInvoice '
  390. +N' Where SaleInvoice.ID_Assessor Is Not Null '
  391. +N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',InvoiceDate_SaleInvoice) &lt;0 '
  392. +N' And Disable_SaleInvoice = 0 '
  393. +N' Group By ID_Customer '
  394. +N' )B On B.ID_Customer = A.ID_Customer '
  395. +N' Left Join '
  396. +N' ( '
  397. +N' Select ID_Customer,Sum(Amount_Preget) As Little '
  398. +N' From Preget '
  399. +N' Where PreGet.ID_Assessor Is Not Null '
  400. +N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',Date_PreGet) &lt; 0 '
  401. +N' Group By ID_Customer '
  402. +N' )C On C.ID_Customer = A.ID_Customer '
  403. +N' )x '
  404. +N' left join '
  405. +N' ( '
  406. +N' Select No_Customer As No_Customer2 '
  407. +N' ,'+nchar(39)+'发票'+nchar(39)+N' As BillType '
  408. +N' ,No_Invoice As BillNo '
  409. +N' ,InvoiceDate_SaleInvoice As BillDate '
  410. +N' ,IsNull(Amount_SaleInvoice,0) As BillMoney '
  411. +N' ,NULL As PrePayMoney '
  412. +N' ,NULL As BillNote '
  413. +N' From SaleInvoice'
  414. +N' Left Join Customer On SaleInvoice.ID_Customer = Customer.ID_Customer '
  415. +N' Where SaleInvoice.ID_Assessor Is Not Null '
  416. +N' and InvoiceDate_SaleInvoice is not null '
  417. +N' And Disable_SaleInvoice = 0 '
  418. if(@StartDate Is Not Null)
  419. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',InvoiceDate_SaleInvoice) &gt;=0 '
  420. if(@EndDate Is Not Null)
  421. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate)+nchar(39)+N',InvoiceDate_SaleInvoice) &lt;=0 '
  422. if(@StartNo_Customer Is Not Null)
  423. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  424. if(@EndNo_Customer Is Not Null)
  425. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  426. set @sqlCmd=@sqlCmd+N' Union All '
  427. +N' Select No_Customer As No_Customer2'
  428. +N' ,'+nchar(39)+'收款'+nchar(39)+N' As BillType '
  429. +N' ,No_PreGet As BillNo '
  430. +N' ,Date_PreGet As BillDate '
  431. +N' ,NULL As BillMoney '
  432. +N' ,IsNull(Amount_PreGet,0) As PrePayMoney '
  433. +N' ,Comment_PreGet As BillNote '
  434. +N' From PreGet '
  435. +N' Left Join Customer On PreGet.ID_Customer = Customer.ID_Customer '
  436. +N' Where PreGet.ID_Assessor Is Not Null '
  437. if(@StartDate Is Not Null)
  438. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',Date_PreGet) &gt;=0 '
  439. if(@EndDate Is Not Null)
  440. set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate)+nchar(39)+N',Date_PreGet) &lt;=0 '
  441. if(@StartNo_Customer Is Not Null)
  442. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  443. if(@EndNo_Customer Is Not Null)
  444. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  445. set @sqlCmd=@sqlCmd+N' )y on y.No_Customer2 = x.No_Customer '
  446. set @sqlCmd=@sqlCmd+N' Order By No_Customer,BillDate'
  447. EXECUTE sp_executesql @sqlCmd">
  448. <Params>
  449. <Param name="@StartDate" type="SaleInvoice.InvoiceDate_SaleInvoice" Index="0" />
  450. <Param name="@EndDate" type="SaleInvoice.InvoiceDate_SaleInvoice" Index="1" />
  451. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="2" />
  452. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="3" />
  453. <Param name="@Company_Name" type="Customer.No_Customer" Index="4" />
  454. </Params>
  455. <Tables>
  456. <Table name="FrmReceivableStrikeDetails"/>
  457. </Tables>
  458. </SearchReceivableStrikeDetails>
  459. </Search>
  460. </Server>
  461. </Form>
  462. </Forms>