FrmSalesMonthReport.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSalesMonthReport">
  4. <Client>
  5. <Events>
  6. <Load><![CDATA[
  7. @Title="销货月报表";
  8. GetSchema();
  9. txtCoNo.CValue=GetCurrentCompanyNo();
  10. txtCoName.CValue=GetCurrentCompanyShortName();
  11. Empty();
  12. NewInstance();
  13. #UI.StartDate_SaleBill = GetCurrentTime();
  14. #UI.EndDate_SaleBill = GetCurrentTime();
  15. ]]></Load>
  16. <Closing>
  17. ;
  18. </Closing>
  19. <Closed>
  20. ;
  21. </Closed>
  22. </Events>
  23. <Mode>
  24. <Search>
  25. <Lable name="Search"/>
  26. </Search>
  27. </Mode>
  28. <Controls>
  29. <IKDateTimePicker name="dtStart" DataSource="UI.StartDate_SaleBill">
  30. <Events>
  31. <CheckedChanged>
  32. dtEnd.Checked = dtStart.Checked;
  33. </CheckedChanged>
  34. <ValueChanged>
  35. dtEnd.CValue = dtStart.CValue;
  36. </ValueChanged>
  37. </Events>
  38. </IKDateTimePicker>
  39. <IKDateTimePicker name="dtEnd" DataSource="UI.EndDate_SaleBill"/>
  40. <IKTextButton name="tbSaleBillNo1" DataSource="UI.StartNo_SaleBill">
  41. <Events>
  42. <Click>
  43. @temp=ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
  44. if(@temp=="")
  45. return;
  46. tbSaleBillNo1.CValue=@temp;
  47. </Click>
  48. <TextBoxButtonTextChanged>
  49. tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
  50. </TextBoxButtonTextChanged>
  51. </Events>
  52. </IKTextButton>
  53. <IKTextButton name="tbSaleBillNo2" DataSource="UI.EndNo_SaleBill" >
  54. <Events>
  55. <Click>
  56. @temp=ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
  57. if(@temp=="")
  58. return;
  59. tbSaleBillNo2.CValue=@temp;
  60. </Click>
  61. </Events>
  62. </IKTextButton>
  63. <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
  64. <Events>
  65. <Click>
  66. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  67. if( @temp == "" )
  68. return;
  69. tbCustomerNo1.CValue = @temp;
  70. </Click>
  71. <TextBoxButtonTextChanged>
  72. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  73. </TextBoxButtonTextChanged>
  74. </Events>
  75. </IKTextButton>
  76. <IKTextButton name="tbCustomerNo2" DataSource="UI.EndNo_Customer">
  77. <Events>
  78. <Click>
  79. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  80. if( @temp == "" )
  81. return;
  82. tbCustomerNo2.CValue = @temp;
  83. </Click>
  84. </Events>
  85. </IKTextButton>
  86. <IKComboBoxEx name="cbPrincipal1" DisplaySource="UI.StartPrincipal_SaleBill" NoSource="UI.StartNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  87. <Events>
  88. <Reload>
  89. UpdateForm(false, "cbPrincipal1");
  90. Search("SearchPrincipal");
  91. UpdateForm(true, "cbPrincipal1");
  92. </Reload>
  93. <TextChanged>
  94. cbPrincipal2.SelectedName = cbPrincipal1.SelectedName;
  95. cbPrincipal2.SelectedNo=cbPrincipal1.SelectedNo;
  96. </TextChanged>
  97. </Events>
  98. </IKComboBoxEx>
  99. <IKComboBoxEx name="cbPrincipal2" DisplaySource="UI.EndPrincipal_SaleBill" NoSource="UI.EndNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  100. <Events>
  101. <Reload>
  102. UpdateForm(false, "cbPrincipal2");
  103. Search("SearchPrincipal");
  104. UpdateForm(true, "cbPrincipal2");
  105. </Reload>
  106. </Events>
  107. </IKComboBoxEx>
  108. <IKComboBoxEx name="cbLocation1" DisplaySource="UI.StartName_Location" NoSource="UI.StartNo_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" >
  109. <Events>
  110. <Reload>
  111. UpdateForm(false, "cbLocation1");
  112. Search("SearchLocation");
  113. UpdateForm(true, "cbLocation1");
  114. </Reload>
  115. <TextChanged>
  116. cbLocation2.SelectedName = cbLocation1.SelectedName;
  117. cbLocation2.SelectedNo = cbLocation1.SelectedNo;
  118. </TextChanged>
  119. </Events>
  120. </IKComboBoxEx>
  121. <IKComboBoxEx name="cbLocation2" DisplaySource="UI.EndName_Location" NoSource="UI.EndNo_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" >
  122. <Events>
  123. <Reload>
  124. UpdateForm(false, "cbLocation2");
  125. Search("SearchLocation");
  126. UpdateForm(true, "cbLocation2");
  127. </Reload>
  128. </Events>
  129. </IKComboBoxEx>
  130. <IKButton name="btnView">
  131. <Events>
  132. <Click>
  133. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false)
  134. {
  135. MessageBox("请选择格式!",@Title);
  136. return;
  137. }
  138. UpdateForm(false,"");
  139. #UI.Name_Creator = GetCurrentUser();
  140. #UI.CreateDate = GetCurrentTime();
  141. @StartDate_SaleBill=DBNull();
  142. @EndDate_SaleBill=DBNull();
  143. @StartNo_SaleBill = DBNull();
  144. @EndNo_SaleBill = DBNull();
  145. @StartNo_Customer = DBNull();
  146. @EndNo_Customer = DBNull();
  147. @StartNo_Principal= DBNull();
  148. @EndNo_Principal = DBNull();
  149. @StartNo_Location = DBNull();
  150. @EndNo_Location = DBNull();
  151. if(dtStart.Checked)
  152. @StartDate_SaleBill=dtStart.Value;
  153. else
  154. #UI.StartDate_SaleBill=DBNull();
  155. if(dtEnd.Checked)
  156. @EndDate_SaleBill=dtEnd.Value;
  157. else
  158. #UI.EndDate_SaleBill=DBNull();
  159. if(tbSaleBillNo1.CValue != "")
  160. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  161. if(tbSaleBillNo2.CValue != "")
  162. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  163. if(tbCustomerNo1.CValue != "")
  164. @StartNo_Customer = tbCustomerNo1.CValue;
  165. if(tbCustomerNo2.CValue != "")
  166. @EndNo_Customer = tbCustomerNo2.CValue;
  167. if(cbPrincipal1.Text!="")
  168. {
  169. if(!cbPrincipal1.CheckSelectedItem())
  170. {
  171. MessageBox("请选择有效的业务负责人!",@Title);
  172. cbPrincipal1.Focus();
  173. return;
  174. }
  175. else
  176. {
  177. @StartNo_Principal = cbPrincipal1.SelectedNo;
  178. }
  179. }
  180. if(cbPrincipal2.Text!="")
  181. {
  182. if(!cbPrincipal2.CheckSelectedItem())
  183. {
  184. MessageBox("请选择有效的业务负责人!",@Title);
  185. cbPrincipal2.Focus();
  186. return;
  187. }
  188. else
  189. {
  190. @EndNo_Principal = cbPrincipal2.SelectedNo;
  191. }
  192. }
  193. if(cbLocation1.Text!="")
  194. {
  195. if(!cbLocation1.CheckSelectedItem())
  196. {
  197. MessageBox("请选择有效的仓库!",@Title);
  198. cbLocation1.Focus();
  199. return;
  200. }
  201. else
  202. {
  203. @StartNo_Location = cbLocation1.SelectedNo;
  204. }
  205. }
  206. if(cbLocation2.Text!="")
  207. {
  208. if(!cbLocation2.CheckSelectedItem())
  209. {
  210. MessageBox("请选择有效的仓库!",@Title);
  211. cbLocation2.Focus();
  212. return;
  213. }
  214. else
  215. {
  216. @EndNo_Location = cbLocation2.SelectedNo;
  217. }
  218. }
  219. <!--MessageBox(TypeConvert("String",#UI.StartPrincipal_SaleBill));
  220. MessageBox(TypeConvert("String",#UI.StartName_Location));
  221. MessageBox(cbPrincipal2.SelectedNo);
  222. MessageBox(cbLocation2.SelectedNo);-->
  223. if(ikRadioButton1.Checked)
  224. {
  225. Search("SearchSalesMonthByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  226. if(RowCount("#FrmSalesMonthByPrincipal")==0)
  227. {
  228. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  229. }
  230. else
  231. {
  232. PrintReport("UIFrmSalesMonthByPrincipal","UI","FrmSalesMonthByPrincipal");
  233. }
  234. }
  235. else
  236. {
  237. Search("SearchSalesMonthByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  238. if(RowCount("#FrmSalesMonthByProduct")==0)
  239. {
  240. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  241. }
  242. else
  243. {
  244. PrintReport("UIFrmSalesMonthByProduct","UI","FrmSalesMonthByProduct");
  245. }
  246. }
  247. </Click>
  248. </Events>
  249. </IKButton>
  250. <IKButton name="btnExcel">
  251. <Events>
  252. <Click>
  253. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false)
  254. {
  255. MessageBox("请选择格式!",@Title);
  256. return;
  257. }
  258. UpdateForm(false,"");
  259. #UI.Name_Creator = GetCurrentUser();
  260. #UI.CreateDate = GetCurrentTime();
  261. @StartDate_SaleBill=DBNull();
  262. @EndDate_SaleBill=DBNull();
  263. @StartNo_SaleBill = DBNull();
  264. @EndNo_SaleBill = DBNull();
  265. @StartNo_Customer = DBNull();
  266. @EndNo_Customer = DBNull();
  267. @StartNo_Principal= DBNull();
  268. @EndNo_Principal = DBNull();
  269. @StartNo_Location = DBNull();
  270. @EndNo_Location = DBNull();
  271. if(dtStart.Checked)
  272. @StartDate_SaleBill=dtStart.Value;
  273. else
  274. #UI.StartDate_SaleBill=DBNull();
  275. if(dtEnd.Checked)
  276. @EndDate_SaleBill=dtEnd.Value;
  277. else
  278. #UI.EndDate_SaleBill=DBNull();
  279. if(tbSaleBillNo1.CValue != "")
  280. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  281. if(tbSaleBillNo2.CValue != "")
  282. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  283. if(tbCustomerNo1.CValue != "")
  284. @StartNo_Customer = tbCustomerNo1.CValue;
  285. if(tbCustomerNo2.CValue != "")
  286. @EndNo_Customer = tbCustomerNo2.CValue;
  287. if(cbPrincipal1.Text!="")
  288. {
  289. if(!cbPrincipal1.CheckSelectedItem())
  290. {
  291. MessageBox("请选择有效的业务负责人!",@Title);
  292. cbPrincipal1.Focus();
  293. return;
  294. }
  295. else
  296. {
  297. @StartNo_Principal = cbPrincipal1.SelectedNo;
  298. }
  299. }
  300. if(cbPrincipal2.Text!="")
  301. {
  302. if(!cbPrincipal2.CheckSelectedItem())
  303. {
  304. MessageBox("请选择有效的业务负责人!",@Title);
  305. cbPrincipal2.Focus();
  306. return;
  307. }
  308. else
  309. {
  310. @EndNo_Principal = cbPrincipal2.SelectedNo;
  311. }
  312. }
  313. if(cbLocation1.Text!="")
  314. {
  315. if(!cbLocation1.CheckSelectedItem())
  316. {
  317. MessageBox("请选择有效的仓库!",@Title);
  318. cbLocation1.Focus();
  319. return;
  320. }
  321. else
  322. {
  323. @StartNo_Location = cbLocation1.SelectedNo;
  324. }
  325. }
  326. if(cbLocation2.Text!="")
  327. {
  328. if(!cbLocation2.CheckSelectedItem())
  329. {
  330. MessageBox("请选择有效的仓库!",@Title);
  331. cbLocation2.Focus();
  332. return;
  333. }
  334. else
  335. {
  336. @EndNo_Location = cbLocation2.SelectedNo;
  337. }
  338. }
  339. <!--MessageBox(TypeConvert("String",#UI.StartPrincipal_SaleBill));
  340. MessageBox(TypeConvert("String",#UI.StartName_Location));
  341. MessageBox(cbPrincipal2.SelectedNo);
  342. MessageBox(cbLocation2.SelectedNo);-->
  343. if(ikRadioButton1.Checked)
  344. {
  345. Search("SearchSalesMonthByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  346. if(RowCount("#FrmSalesMonthByPrincipal")==0)
  347. {
  348. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  349. }
  350. else
  351. {
  352. ExportReport("Excel","UIFrmSalesMonthByPrincipal","UI","FrmSalesMonthByPrincipal");
  353. }
  354. }
  355. else
  356. {
  357. Search("SearchSalesMonthByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  358. if(RowCount("#FrmSalesMonthByProduct")==0)
  359. {
  360. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  361. }
  362. else
  363. {
  364. ExportReport("Excel","UIFrmSalesMonthByProduct","UI","FrmSalesMonthByProduct");
  365. }
  366. }
  367. </Click>
  368. </Events>
  369. </IKButton>
  370. <IKButton name="btnWord">
  371. <Events>
  372. <Click>
  373. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false)
  374. {
  375. MessageBox("请选择格式!",@Title);
  376. return;
  377. }
  378. UpdateForm(false,"");
  379. #UI.Name_Creator = GetCurrentUser();
  380. #UI.CreateDate = GetCurrentTime();
  381. @StartDate_SaleBill=DBNull();
  382. @EndDate_SaleBill=DBNull();
  383. @StartNo_SaleBill = DBNull();
  384. @EndNo_SaleBill = DBNull();
  385. @StartNo_Customer = DBNull();
  386. @EndNo_Customer = DBNull();
  387. @StartNo_Principal= DBNull();
  388. @EndNo_Principal = DBNull();
  389. @StartNo_Location = DBNull();
  390. @EndNo_Location = DBNull();
  391. if(dtStart.Checked)
  392. @StartDate_SaleBill=dtStart.Value;
  393. else
  394. #UI.StartDate_SaleBill=DBNull();
  395. if(dtEnd.Checked)
  396. @EndDate_SaleBill=dtEnd.Value;
  397. else
  398. #UI.EndDate_SaleBill=DBNull();
  399. if(tbSaleBillNo1.CValue != "")
  400. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  401. if(tbSaleBillNo2.CValue != "")
  402. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  403. if(tbCustomerNo1.CValue != "")
  404. @StartNo_Customer = tbCustomerNo1.CValue;
  405. if(tbCustomerNo2.CValue != "")
  406. @EndNo_Customer = tbCustomerNo2.CValue;
  407. if(cbPrincipal1.Text!="")
  408. {
  409. if(!cbPrincipal1.CheckSelectedItem())
  410. {
  411. MessageBox("请选择有效的业务负责人!",@Title);
  412. cbPrincipal1.Focus();
  413. return;
  414. }
  415. else
  416. {
  417. @StartNo_Principal = cbPrincipal1.SelectedNo;
  418. }
  419. }
  420. if(cbPrincipal2.Text!="")
  421. {
  422. if(!cbPrincipal2.CheckSelectedItem())
  423. {
  424. MessageBox("请选择有效的业务负责人!",@Title);
  425. cbPrincipal2.Focus();
  426. return;
  427. }
  428. else
  429. {
  430. @EndNo_Principal = cbPrincipal2.SelectedNo;
  431. }
  432. }
  433. if(cbLocation1.Text!="")
  434. {
  435. if(!cbLocation1.CheckSelectedItem())
  436. {
  437. MessageBox("请选择有效的仓库!",@Title);
  438. cbLocation1.Focus();
  439. return;
  440. }
  441. else
  442. {
  443. @StartNo_Location = cbLocation1.SelectedNo;
  444. }
  445. }
  446. if(cbLocation2.Text!="")
  447. {
  448. if(!cbLocation2.CheckSelectedItem())
  449. {
  450. MessageBox("请选择有效的仓库!",@Title);
  451. cbLocation2.Focus();
  452. return;
  453. }
  454. else
  455. {
  456. @EndNo_Location = cbLocation2.SelectedNo;
  457. }
  458. }
  459. <!--MessageBox(TypeConvert("String",#UI.StartPrincipal_SaleBill));
  460. MessageBox(TypeConvert("String",#UI.StartName_Location));
  461. MessageBox(cbPrincipal2.SelectedNo);
  462. MessageBox(cbLocation2.SelectedNo);-->
  463. if(ikRadioButton1.Checked)
  464. {
  465. Search("SearchSalesMonthByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  466. if(RowCount("#FrmSalesMonthByPrincipal")==0)
  467. {
  468. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  469. }
  470. else
  471. {
  472. ExportReport("Word","UIFrmSalesMonthByPrincipal","UI","FrmSalesMonthByPrincipal");
  473. }
  474. }
  475. else
  476. {
  477. Search("SearchSalesMonthByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  478. if(RowCount("#FrmSalesMonthByProduct")==0)
  479. {
  480. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  481. }
  482. else
  483. {
  484. ExportReport("Word","UIFrmSalesMonthByProduct","UI","FrmSalesMonthByProduct");
  485. }
  486. }
  487. </Click>
  488. </Events>
  489. </IKButton>
  490. <IKButton name="btnPrint">
  491. <Events>
  492. <Click>
  493. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false)
  494. {
  495. MessageBox("请选择格式!",@Title);
  496. return;
  497. }
  498. UpdateForm(false,"");
  499. #UI.Name_Creator = GetCurrentUser();
  500. #UI.CreateDate = GetCurrentTime();
  501. @StartDate_SaleBill=DBNull();
  502. @EndDate_SaleBill=DBNull();
  503. @StartNo_SaleBill = DBNull();
  504. @EndNo_SaleBill = DBNull();
  505. @StartNo_Customer = DBNull();
  506. @EndNo_Customer = DBNull();
  507. @StartNo_Principal= DBNull();
  508. @EndNo_Principal = DBNull();
  509. @StartNo_Location = DBNull();
  510. @EndNo_Location = DBNull();
  511. if(dtStart.Checked)
  512. @StartDate_SaleBill=dtStart.Value;
  513. else
  514. #UI.StartDate_SaleBill=DBNull();
  515. if(dtEnd.Checked)
  516. @EndDate_SaleBill=dtEnd.Value;
  517. else
  518. #UI.EndDate_SaleBill=DBNull();
  519. if(tbSaleBillNo1.CValue != "")
  520. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  521. if(tbSaleBillNo2.CValue != "")
  522. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  523. if(tbCustomerNo1.CValue != "")
  524. @StartNo_Customer = tbCustomerNo1.CValue;
  525. if(tbCustomerNo2.CValue != "")
  526. @EndNo_Customer = tbCustomerNo2.CValue;
  527. if(cbPrincipal1.Text!="")
  528. {
  529. if(!cbPrincipal1.CheckSelectedItem())
  530. {
  531. MessageBox("请选择有效的业务负责人!",@Title);
  532. cbPrincipal1.Focus();
  533. return;
  534. }
  535. else
  536. {
  537. @StartNo_Principal = cbPrincipal1.SelectedNo;
  538. }
  539. }
  540. if(cbPrincipal2.Text!="")
  541. {
  542. if(!cbPrincipal2.CheckSelectedItem())
  543. {
  544. MessageBox("请选择有效的业务负责人!",@Title);
  545. cbPrincipal2.Focus();
  546. return;
  547. }
  548. else
  549. {
  550. @EndNo_Principal = cbPrincipal2.SelectedNo;
  551. }
  552. }
  553. if(cbLocation1.Text!="")
  554. {
  555. if(!cbLocation1.CheckSelectedItem())
  556. {
  557. MessageBox("请选择有效的仓库!",@Title);
  558. cbLocation1.Focus();
  559. return;
  560. }
  561. else
  562. {
  563. @StartNo_Location = cbLocation1.SelectedNo;
  564. }
  565. }
  566. if(cbLocation2.Text!="")
  567. {
  568. if(!cbLocation2.CheckSelectedItem())
  569. {
  570. MessageBox("请选择有效的仓库!",@Title);
  571. cbLocation2.Focus();
  572. return;
  573. }
  574. else
  575. {
  576. @EndNo_Location = cbLocation2.SelectedNo;
  577. }
  578. }
  579. <!--MessageBox(TypeConvert("String",#UI.StartPrincipal_SaleBill));
  580. MessageBox(TypeConvert("String",#UI.StartName_Location));
  581. MessageBox(cbPrincipal2.SelectedNo);
  582. MessageBox(cbLocation2.SelectedNo);-->
  583. if(ikRadioButton1.Checked)
  584. {
  585. Search("SearchSalesMonthByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  586. if(RowCount("#FrmSalesMonthByPrincipal")==0)
  587. {
  588. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  589. }
  590. else
  591. {
  592. ExportReport("PrintToPrinter","UIFrmSalesMonthByPrincipal","UI","FrmSalesMonthByPrincipal");
  593. }
  594. }
  595. else
  596. {
  597. Search("SearchSalesMonthByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  598. if(RowCount("#FrmSalesMonthByProduct")==0)
  599. {
  600. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  601. }
  602. else
  603. {
  604. ExportReport("PrintToPrinter","UIFrmSalesMonthByProduct","UI","FrmSalesMonthByProduct");
  605. }
  606. }
  607. </Click>
  608. </Events>
  609. </IKButton>
  610. </Controls>
  611. <ChildForms>
  612. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchSaleBillWithNo">
  613. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  614. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  615. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  616. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  617. <DataColumn Index="4" MappingName="#SaleBill.Name_Principal" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  618. <DataColumn Index="5" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  619. <DataColumn Index="5" MappingName="#SaleBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  620. <DataColumn Index="6" MappingName="#SaleBill.Tel_SaleBill" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  621. <DataColumn Index="7" MappingName="#SaleBill.Fax_SaleBill" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  622. </ChildForm>
  623. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  624. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  625. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  626. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  627. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  628. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  629. </ChildForm>
  630. <!--<ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  631. <DataColumn Index="0" MappingName="No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  632. <DataColumn Index="1" MappingName="Name_Product" HeaderText="产品简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  633. </ChildForm>-->
  634. </ChildForms>
  635. <FormatString>
  636. <Format name="SearchCustomerCondition">
  637. if(GetRight("客户基本资料","全权查看"))
  638. {
  639. FormatString("");
  640. }
  641. else
  642. {
  643. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  644. }
  645. </Format>
  646. <Format name="SearchBillCondition">
  647. if(GetRight("客户基本资料","全权查看"))
  648. {
  649. FormatString("");
  650. }
  651. else
  652. {
  653. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  654. }
  655. </Format>
  656. </FormatString>
  657. </Client>
  658. <Server>
  659. <Tables>
  660. <Table name="UI" Type="Parent">
  661. <GetSchema CmdType="Text" CmdText="
  662. SELECT TOP 0 convert(datetime,0) As StartDate_SaleBill,convert(datetime,0) As EndDate_SaleBill,convert(nvarchar(64),'') As StartNo_SaleBill,convert(nvarchar(64),'') As EndNo_SaleBill,
  663. convert(nvarchar(64),'') As StartNo_Customer,convert(nvarchar(64),'') As EndNo_Customer,convert(nvarchar(64),'') As StartNo_Principal,convert(nvarchar(64),'') As EndNo_Principal,
  664. convert(nvarchar(64),'') As StartPrincipal_SaleBill,convert(nvarchar(64),'') As EndPrincipal_SaleBill,convert(nvarchar(64),'') As StartName_Location,convert(nvarchar(64),'') As EndName_Location,convert(nvarchar(64),'') As StartNo_Location,convert(nvarchar(64),'') As EndNo_Location,
  665. convert(nvarchar(64),'') As Name_Creator,convert(datetime,0) As CreateDate
  666. --From SaleBill
  667. "/>
  668. </Table>
  669. </Tables>
  670. <Search>
  671. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  672. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  673. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  674. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  675. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
  676. FROM SaleBill
  677. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  678. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  679. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  680. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  681. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  682. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  683. ">
  684. <Tables>
  685. <Table name="AllBill" />
  686. </Tables>
  687. </SearchAllBill>
  688. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  689. <Tables>
  690. <Table name="AllCustomer" />
  691. </Tables>
  692. </SearchAllCustomer>
  693. <SearchPrincipal CmdType="Text" CmdText="
  694. Select No_Employee,Name_Employee
  695. From Employee
  696. ORDER BY No_Employee">
  697. <Tables>
  698. <Table name="Principal" />
  699. </Tables>
  700. </SearchPrincipal>
  701. <SearchLocation CmdType="Text" CmdText=" SELECT No_Location,Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY No_Location">
  702. <Tables>
  703. <Table name="Location" />
  704. </Tables>
  705. </SearchLocation>
  706. <SearchSalesMonthByProduct CmdType="Text" CmdText="
  707. declare @cessOut decimal(14,4)
  708. declare @sqlCmd nvarchar(4000)
  709. Select @cessOut=CessOut_SystemSetting From SystemSetting
  710. set @sqlCmd=N'Select No_Product,Name_Product,Type='+nchar(39)+N'销货'+nchar(39)+N',No_SaleBill,Name_Location,Currency_SaleBill,Quantity_SaleBillProduct,Unit_Product,UnitPrice_SaleBillProduct,SaleBill.TaxCurrency_SaleBill, '
  711. +N' GoodsAmount_Product=case SaleBill.TaxCurrency_SaleBill '
  712. +N' When '+nchar(39)+'内含'+nchar(39)+N' Then (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+'+convert(nvarchar(64),@cessOut)+N'/100) '
  713. +N' else (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct) end,'
  714. +N' Amount_Product=case SaleBill.TaxCurrency_SaleBill '
  715. +N' When '+nchar(39)+'外加'+nchar(39)+N' Then (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+'+convert(nvarchar(64),@cessOut)+N'/100) '
  716. +N' else (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct) end,Date_SaleBill From SaleBill '
  717. +N' Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill '
  718. +N' Join Product On Product.ID_Product=SaleBillProduct.ID_Product '
  719. +N' Join Location On Location.ID_Location=SaleBill.ID_Location '
  720. +N' Join Customer On Customer.ID_Customer=SaleBill.ID_Customer '
  721. +N' Left Join Employee On Employee.ID_Employee=SaleBill.ID_Principal '
  722. +N' Where SaleBill.ID_Assessor IS Not Null '
  723. if(@StartDate_SaleBill Is Not Null)
  724. set @sqlCmd=@sqlCmd+N' And DateDiff(month,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N',Date_SaleBill) &gt;=0 '
  725. if(@EndDate_SaleBill Is Not Null)
  726. set @sqlCmd=@sqlCmd+N' And DateDiff(month,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N',Date_SaleBill) &lt;=0 '
  727. if(@StartNo_SaleBill Is Not Null)
  728. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  729. if(@EndNo_SaleBill Is Not Null)
  730. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  731. if(@StartNo_Customer Is Not Null)
  732. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  733. if(@EndNo_Customer Is Not Null)
  734. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  735. if(@StartNo_Principal Is Not Null)
  736. set @sqlCmd=@sqlCmd+N' And No_Employee &gt;= '+nchar(39)+@StartNo_Principal+nchar(39)
  737. if(@EndNo_Principal Is Not Null)
  738. set @sqlCmd=@sqlCmd+N' And No_Employee &lt;= '+nchar(39)+@EndNo_Principal+nchar(39)
  739. if(@StartNo_Location Is Not Null)
  740. set @sqlCmd=@sqlCmd+N' And No_Location &gt;= '+nchar(39)+@StartNo_Location +nchar(39)
  741. if(@EndNo_Location Is Not Null)
  742. set @sqlCmd=@sqlCmd+N' And No_Location &lt;= '+nchar(39)+@EndNo_Location+nchar(39)
  743. if(@Right Is Not Null)
  744. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  745. if(@Special=0)
  746. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  747. set @sqlCmd=@sqlCmd+N' Order By No_Product,No_SaleBill '
  748. EXECUTE sp_executesql @sqlCmd
  749. ">
  750. <Params>
  751. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  752. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  753. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  754. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  755. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  756. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  757. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  758. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  759. <Param name="@StartNo_Location" type="Location.No_Location" Index="8" />
  760. <Param name="@EndNo_Location" type="Location.No_Location" Index="9" />
  761. <Param name="@Right" type="SaleBill.ID_Customer" Index="10" />
  762. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="11" />
  763. </Params>
  764. <Tables>
  765. <Table name="FrmSalesMonthByProduct"/>
  766. </Tables>
  767. </SearchSalesMonthByProduct>
  768. <SearchSalesMonthByPrincipal CmdType="Text" CmdText="
  769. declare @sqlCmd nvarchar(4000)
  770. set @sqlCmd=N'Select Name_Employee As Principal_SaleBill,Type='+nchar(39)+N'销货'+nchar(39)+N',No_SaleBill,ShortName_Customer,Name_Location,Currency_SaleBill,GoodsAmount_SaleBill,Amount_SaleBill,TaxAmount_SaleBill,TaxCurrency_SaleBill,Date_SaleBill
  771. From SaleBill
  772. Join Location On Location.ID_Location=SaleBill.ID_Location
  773. Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  774. Left Join Employee On Employee.ID_Employee=SaleBill.ID_Principal
  775. Where SaleBill.ID_Assessor Is Not Null '
  776. if(@StartDate_SaleBill Is Not Null)
  777. set @sqlCmd=@sqlCmd+N' And DateDiff(month,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N',Date_SaleBill) &gt;=0 '
  778. if(@EndDate_SaleBill Is Not Null)
  779. set @sqlCmd=@sqlCmd+N' And DateDiff(month,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N',Date_SaleBill) &lt;=0 '
  780. if(@StartNo_SaleBill Is Not Null)
  781. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  782. if(@EndNo_SaleBill Is Not Null)
  783. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  784. if(@StartNo_Customer Is Not Null)
  785. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  786. if(@EndNo_Customer Is Not Null)
  787. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  788. if(@StartNo_Principal Is Not Null)
  789. set @sqlCmd=@sqlCmd+N' And No_Employee &gt;= '+nchar(39)+@StartNo_Principal+nchar(39)
  790. if(@EndNo_Principal Is Not Null)
  791. set @sqlCmd=@sqlCmd+N' And No_Employee &lt;= '+nchar(39)+@EndNo_Principal+nchar(39)
  792. if(@StartNo_Location Is Not Null)
  793. set @sqlCmd=@sqlCmd+N' And No_Location &gt;= '+nchar(39)+@StartNo_Location +nchar(39)
  794. if(@EndNo_Location Is Not Null)
  795. set @sqlCmd=@sqlCmd+N' And No_Location &lt;= '+nchar(39)+@EndNo_Location+nchar(39)
  796. if(@Right Is Not Null)
  797. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  798. if(@Special=0)
  799. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  800. set @sqlCmd=@sqlCmd+N' Order By Principal_SaleBill,No_SaleBill '
  801. EXECUTE sp_executesql @sqlCmd
  802. ">
  803. <Params>
  804. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  805. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  806. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  807. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  808. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  809. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  810. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  811. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  812. <Param name="@StartNo_Location" type="Location.No_Location" Index="8" />
  813. <Param name="@EndNo_Location" type="Location.No_Location" Index="9" />
  814. <Param name="@Right" type="SaleBill.ID_Customer" Index="10" />
  815. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="11" />
  816. </Params>
  817. <Tables>
  818. <Table name="FrmSalesMonthByPrincipal"/>
  819. </Tables>
  820. </SearchSalesMonthByPrincipal>
  821. </Search>
  822. </Server>
  823. </Form>
  824. </Forms>