FrmSalesDailyReport.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSalesDailyReport">
  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 &amp;&amp; ikRadioButton3.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. if(ikRadioButton3.Checked)
  220. {
  221. Search("SearchSalesDailyByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  222. if(RowCount("#FrmSalesDailyByProduct")==0)
  223. {
  224. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  225. return;
  226. }
  227. else
  228. {
  229. PrintReport("UIFrmSalesDailyByProduct", "UI","FrmSalesDailyByProduct");
  230. }
  231. }
  232. else if(ikRadioButton1.Checked)
  233. {
  234. Search("SearchSalesDailyByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  235. if(RowCount("#FrmSalesDailyByPrincipal")==0)
  236. {
  237. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  238. }
  239. else
  240. {
  241. PrintReport("UIFrmSalesDailyByPrincipal","UI","FrmSalesDailyByPrincipal");
  242. }
  243. }
  244. else
  245. {
  246. Search("SearchSalesDailyByLocation",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  247. if(RowCount("#FrmSalesDailyByLocation")==0)
  248. {
  249. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  250. }
  251. else
  252. {
  253. PrintReport("UIFrmSalesDailyByLocation","UI","FrmSalesDailyByLocation");
  254. }
  255. }
  256. </Click>
  257. </Events>
  258. </IKButton>
  259. <IKButton name="btnExcel">
  260. <Events>
  261. <Click>
  262. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false &amp;&amp; ikRadioButton3.Checked==false)
  263. {
  264. MessageBox("请选择格式!",@Title);
  265. return;
  266. }
  267. UpdateForm(false,"");
  268. #UI.Name_Creator = GetCurrentUser();
  269. #UI.CreateDate = GetCurrentTime();
  270. @StartDate_SaleBill=DBNull();
  271. @EndDate_SaleBill=DBNull();
  272. @StartNo_SaleBill = DBNull();
  273. @EndNo_SaleBill = DBNull();
  274. @StartNo_Customer = DBNull();
  275. @EndNo_Customer = DBNull();
  276. @StartNo_Principal= DBNull();
  277. @EndNo_Principal = DBNull();
  278. @StartNo_Location = DBNull();
  279. @EndNo_Location = DBNull();
  280. if(dtStart.Checked)
  281. @StartDate_SaleBill=dtStart.Value;
  282. else
  283. #UI.StartDate_SaleBill=DBNull();
  284. if(dtEnd.Checked)
  285. @EndDate_SaleBill=dtEnd.Value;
  286. else
  287. #UI.EndDate_SaleBill=DBNull();
  288. if(tbSaleBillNo1.CValue != "")
  289. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  290. if(tbSaleBillNo2.CValue != "")
  291. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  292. if(tbCustomerNo1.CValue != "")
  293. @StartNo_Customer = tbCustomerNo1.CValue;
  294. if(tbCustomerNo2.CValue != "")
  295. @EndNo_Customer = tbCustomerNo2.CValue;
  296. if(cbPrincipal1.Text!="")
  297. {
  298. if(!cbPrincipal1.CheckSelectedItem())
  299. {
  300. MessageBox("请选择有效的业务负责人!",@Title);
  301. cbPrincipal1.Focus();
  302. return;
  303. }
  304. else
  305. {
  306. @StartNo_Principal = cbPrincipal1.SelectedNo;
  307. }
  308. }
  309. if(cbPrincipal2.Text!="")
  310. {
  311. if(!cbPrincipal2.CheckSelectedItem())
  312. {
  313. MessageBox("请选择有效的业务负责人!",@Title);
  314. cbPrincipal2.Focus();
  315. return;
  316. }
  317. else
  318. {
  319. @EndNo_Principal = cbPrincipal2.SelectedNo;
  320. }
  321. }
  322. if(cbLocation1.Text!="")
  323. {
  324. if(!cbLocation1.CheckSelectedItem())
  325. {
  326. MessageBox("请选择有效的仓库!",@Title);
  327. cbLocation1.Focus();
  328. return;
  329. }
  330. else
  331. {
  332. @StartNo_Location = cbLocation1.SelectedNo;
  333. }
  334. }
  335. if(cbLocation2.Text!="")
  336. {
  337. if(!cbLocation2.CheckSelectedItem())
  338. {
  339. MessageBox("请选择有效的仓库!",@Title);
  340. cbLocation2.Focus();
  341. return;
  342. }
  343. else
  344. {
  345. @EndNo_Location = cbLocation2.SelectedNo;
  346. }
  347. }
  348. if(ikRadioButton3.Checked)
  349. {
  350. Search("SearchSalesDailyByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  351. if(RowCount("#FrmSalesDailyByProduct")==0)
  352. {
  353. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  354. return;
  355. }
  356. else
  357. {
  358. ExportReport("Excel","UIFrmSalesDailyByProduct", "UI","FrmSalesDailyByProduct");
  359. }
  360. }
  361. else if(ikRadioButton1.Checked)
  362. {
  363. Search("SearchSalesDailyByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  364. if(RowCount("#FrmSalesDailyByPrincipal")==0)
  365. {
  366. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  367. }
  368. else
  369. {
  370. ExportReport("Excel","UIFrmSalesDailyByPrincipal","UI","FrmSalesDailyByPrincipal");
  371. }
  372. }
  373. else
  374. {
  375. Search("SearchSalesDailyByLocation",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  376. if(RowCount("#FrmSalesDailyByLocation")==0)
  377. {
  378. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  379. }
  380. else
  381. {
  382. ExportReport("Excel","UIFrmSalesDailyByLocation","UI","FrmSalesDailyByLocation");
  383. }
  384. }
  385. </Click>
  386. </Events>
  387. </IKButton>
  388. <IKButton name="btnWord">
  389. <Events>
  390. <Click>
  391. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false &amp;&amp; ikRadioButton3.Checked==false)
  392. {
  393. MessageBox("请选择格式!",@Title);
  394. return;
  395. }
  396. UpdateForm(false,"");
  397. #UI.Name_Creator = GetCurrentUser();
  398. #UI.CreateDate = GetCurrentTime();
  399. @StartDate_SaleBill=DBNull();
  400. @EndDate_SaleBill=DBNull();
  401. @StartNo_SaleBill = DBNull();
  402. @EndNo_SaleBill = DBNull();
  403. @StartNo_Customer = DBNull();
  404. @EndNo_Customer = DBNull();
  405. @StartNo_Principal= DBNull();
  406. @EndNo_Principal = DBNull();
  407. @StartNo_Location = DBNull();
  408. @EndNo_Location = DBNull();
  409. if(dtStart.Checked)
  410. @StartDate_SaleBill=dtStart.Value;
  411. else
  412. #UI.StartDate_SaleBill=DBNull();
  413. if(dtEnd.Checked)
  414. @EndDate_SaleBill=dtEnd.Value;
  415. else
  416. #UI.EndDate_SaleBill=DBNull();
  417. if(tbSaleBillNo1.CValue != "")
  418. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  419. if(tbSaleBillNo2.CValue != "")
  420. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  421. if(tbCustomerNo1.CValue != "")
  422. @StartNo_Customer = tbCustomerNo1.CValue;
  423. if(tbCustomerNo2.CValue != "")
  424. @EndNo_Customer = tbCustomerNo2.CValue;
  425. if(cbPrincipal1.Text!="")
  426. {
  427. if(!cbPrincipal1.CheckSelectedItem())
  428. {
  429. MessageBox("请选择有效的业务负责人!",@Title);
  430. cbPrincipal1.Focus();
  431. return;
  432. }
  433. else
  434. {
  435. @StartNo_Principal = cbPrincipal1.SelectedNo;
  436. }
  437. }
  438. if(cbPrincipal2.Text!="")
  439. {
  440. if(!cbPrincipal2.CheckSelectedItem())
  441. {
  442. MessageBox("请选择有效的业务负责人!",@Title);
  443. cbPrincipal2.Focus();
  444. return;
  445. }
  446. else
  447. {
  448. @EndNo_Principal = cbPrincipal2.SelectedNo;
  449. }
  450. }
  451. if(cbLocation1.Text!="")
  452. {
  453. if(!cbLocation1.CheckSelectedItem())
  454. {
  455. MessageBox("请选择有效的仓库!",@Title);
  456. cbLocation1.Focus();
  457. return;
  458. }
  459. else
  460. {
  461. @StartNo_Location = cbLocation1.SelectedNo;
  462. }
  463. }
  464. if(cbLocation2.Text!="")
  465. {
  466. if(!cbLocation2.CheckSelectedItem())
  467. {
  468. MessageBox("请选择有效的仓库!",@Title);
  469. cbLocation2.Focus();
  470. return;
  471. }
  472. else
  473. {
  474. @EndNo_Location = cbLocation2.SelectedNo;
  475. }
  476. }
  477. if(ikRadioButton3.Checked)
  478. {
  479. Search("SearchSalesDailyByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  480. if(RowCount("#FrmSalesDailyByProduct")==0)
  481. {
  482. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  483. return;
  484. }
  485. else
  486. {
  487. ExportReport("Word","UIFrmSalesDailyByProduct", "UI","FrmSalesDailyByProduct");
  488. }
  489. }
  490. else if(ikRadioButton1.Checked)
  491. {
  492. Search("SearchSalesDailyByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  493. if(RowCount("#FrmSalesDailyByPrincipal")==0)
  494. {
  495. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  496. }
  497. else
  498. {
  499. ExportReport("Word","UIFrmSalesDailyByPrincipal","UI","FrmSalesDailyByPrincipal");
  500. }
  501. }
  502. else
  503. {
  504. Search("SearchSalesDailyByLocation",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  505. if(RowCount("#FrmSalesDailyByLocation")==0)
  506. {
  507. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  508. }
  509. else
  510. {
  511. ExportReport("Word","UIFrmSalesDailyByLocation","UI","FrmSalesDailyByLocation");
  512. }
  513. }
  514. </Click>
  515. </Events>
  516. </IKButton>
  517. <IKButton name="btnPrint">
  518. <Events>
  519. <Click>
  520. if(ikRadioButton1.Checked==false &amp;&amp; ikRadioButton2.Checked==false &amp;&amp; ikRadioButton3.Checked==false)
  521. {
  522. MessageBox("请选择格式!",@Title);
  523. return;
  524. }
  525. UpdateForm(false,"");
  526. #UI.Name_Creator = GetCurrentUser();
  527. #UI.CreateDate = GetCurrentTime();
  528. @StartDate_SaleBill=DBNull();
  529. @EndDate_SaleBill=DBNull();
  530. @StartNo_SaleBill = DBNull();
  531. @EndNo_SaleBill = DBNull();
  532. @StartNo_Customer = DBNull();
  533. @EndNo_Customer = DBNull();
  534. @StartNo_Principal= DBNull();
  535. @EndNo_Principal = DBNull();
  536. @StartNo_Location = DBNull();
  537. @EndNo_Location = DBNull();
  538. if(dtStart.Checked)
  539. @StartDate_SaleBill=dtStart.Value;
  540. else
  541. #UI.StartDate_SaleBill=DBNull();
  542. if(dtEnd.Checked)
  543. @EndDate_SaleBill=dtEnd.Value;
  544. else
  545. #UI.EndDate_SaleBill=DBNull();
  546. if(tbSaleBillNo1.CValue != "")
  547. @StartNo_SaleBill = tbSaleBillNo1.CValue;
  548. if(tbSaleBillNo2.CValue != "")
  549. @EndNo_SaleBill = tbSaleBillNo2.CValue;
  550. if(tbCustomerNo1.CValue != "")
  551. @StartNo_Customer = tbCustomerNo1.CValue;
  552. if(tbCustomerNo2.CValue != "")
  553. @EndNo_Customer = tbCustomerNo2.CValue;
  554. if(cbPrincipal1.Text!="")
  555. {
  556. if(!cbPrincipal1.CheckSelectedItem())
  557. {
  558. MessageBox("请选择有效的业务负责人!",@Title);
  559. cbPrincipal1.Focus();
  560. return;
  561. }
  562. else
  563. {
  564. @StartNo_Principal = cbPrincipal1.SelectedNo;
  565. }
  566. }
  567. if(cbPrincipal2.Text!="")
  568. {
  569. if(!cbPrincipal2.CheckSelectedItem())
  570. {
  571. MessageBox("请选择有效的业务负责人!",@Title);
  572. cbPrincipal2.Focus();
  573. return;
  574. }
  575. else
  576. {
  577. @EndNo_Principal = cbPrincipal2.SelectedNo;
  578. }
  579. }
  580. if(cbLocation1.Text!="")
  581. {
  582. if(!cbLocation1.CheckSelectedItem())
  583. {
  584. MessageBox("请选择有效的仓库!",@Title);
  585. cbLocation1.Focus();
  586. return;
  587. }
  588. else
  589. {
  590. @StartNo_Location = cbLocation1.SelectedNo;
  591. }
  592. }
  593. if(cbLocation2.Text!="")
  594. {
  595. if(!cbLocation2.CheckSelectedItem())
  596. {
  597. MessageBox("请选择有效的仓库!",@Title);
  598. cbLocation2.Focus();
  599. return;
  600. }
  601. else
  602. {
  603. @EndNo_Location = cbLocation2.SelectedNo;
  604. }
  605. }
  606. if(ikRadioButton3.Checked)
  607. {
  608. Search("SearchSalesDailyByProduct",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,@EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  609. if(RowCount("#FrmSalesDailyByProduct")==0)
  610. {
  611. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  612. return;
  613. }
  614. else
  615. {
  616. ExportReport("PrintToPrinter","UIFrmSalesDailyByProduct", "UI","FrmSalesDailyByProduct");
  617. }
  618. }
  619. else if(ikRadioButton1.Checked)
  620. {
  621. Search("SearchSalesDailyByPrincipal",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  622. if(RowCount("#FrmSalesDailyByPrincipal")==0)
  623. {
  624. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  625. }
  626. else
  627. {
  628. ExportReport("PrintToPrinter","UIFrmSalesDailyByPrincipal","UI","FrmSalesDailyByPrincipal");
  629. }
  630. }
  631. else
  632. {
  633. Search("SearchSalesDailyByLocation",@StartDate_SaleBill,@EndDate_SaleBill,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer, @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight("销货单","特价单","查看"));
  634. if(RowCount("#FrmSalesDailyByLocation")==0)
  635. {
  636. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  637. }
  638. else
  639. {
  640. ExportReport("PrintToPrinter","UIFrmSalesDailyByLocation","UI","FrmSalesDailyByLocation");
  641. }
  642. }
  643. </Click>
  644. </Events>
  645. </IKButton>
  646. </Controls>
  647. <ChildForms>
  648. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchSaleBillWithNo">
  649. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  650. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  651. <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  652. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  653. <DataColumn Index="4" MappingName="#SaleBill.Name_Principal" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  654. <DataColumn Index="5" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  655. <DataColumn Index="5" MappingName="#SaleBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  656. <DataColumn Index="6" MappingName="#SaleBill.Tel_SaleBill" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  657. <DataColumn Index="7" MappingName="#SaleBill.Fax_SaleBill" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  658. </ChildForm>
  659. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  660. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  661. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  662. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  663. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  664. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  665. </ChildForm>
  666. <!--<ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  667. <DataColumn Index="0" MappingName="No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  668. <DataColumn Index="1" MappingName="Name_Product" HeaderText="产品简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  669. </ChildForm>-->
  670. </ChildForms>
  671. <FormatString>
  672. <Format name="SearchCustomerCondition">
  673. if(GetRight("客户基本资料","全权查看"))
  674. {
  675. FormatString("");
  676. }
  677. else
  678. {
  679. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  680. }
  681. </Format>
  682. <Format name="SearchBillCondition">
  683. if(GetRight("客户基本资料","全权查看"))
  684. {
  685. FormatString("");
  686. }
  687. else
  688. {
  689. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  690. }
  691. </Format>
  692. </FormatString>
  693. </Client>
  694. <Server>
  695. <Tables>
  696. <Table name="UI" Type="Parent">
  697. <GetSchema CmdType="Text" CmdText="
  698. 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,
  699. convert(nvarchar(64),'') As StartNo_Customer,convert(nvarchar(64),'') As EndNo_Customer,convert(nvarchar(64),'') As StartNo_Principal,convert(nvarchar(64),'') As EndNo_Principal,
  700. 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,
  701. convert(nvarchar(64),'') As Name_Creator,convert(datetime,0) As CreateDate
  702. --From SaleBill
  703. "/>
  704. </Table>
  705. </Tables>
  706. <Search>
  707. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  708. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  709. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  710. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  711. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
  712. FROM SaleBill
  713. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  714. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  715. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  716. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  717. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  718. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  719. ">
  720. <Tables>
  721. <Table name="AllBill" />
  722. </Tables>
  723. </SearchAllBill>
  724. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  725. <Tables>
  726. <Table name="AllCustomer" />
  727. </Tables>
  728. </SearchAllCustomer>
  729. <SearchPrincipal CmdType="Text" CmdText="
  730. Select No_Employee,Name_Employee
  731. From Employee
  732. ORDER BY No_Employee">
  733. <Tables>
  734. <Table name="Principal" />
  735. </Tables>
  736. </SearchPrincipal>
  737. <SearchLocation CmdType="Text" CmdText=" SELECT No_Location,Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY No_Location">
  738. <Tables>
  739. <Table name="Location" />
  740. </Tables>
  741. </SearchLocation>
  742. <SearchSalesDailyByProduct CmdType="Text" CmdText="
  743. declare @cessOut decimal(14,4)
  744. declare @sqlCmd nvarchar(4000)
  745. Select @cessOut=CessOut_SystemSetting From SystemSetting
  746. 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, '
  747. +N' GoodsAmount_Product=case SaleBill.TaxCurrency_SaleBill '
  748. +N' When '+nchar(39)+'内含'+nchar(39)+N' Then (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+'+convert(nvarchar(64),@cessOut)+N'/100)'
  749. +N' else (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct) end,'
  750. +N' Amount_Product=case SaleBill.TaxCurrency_SaleBill'
  751. +N' When '+nchar(39)+'外加'+nchar(39)+N' Then (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+'+convert(nvarchar(64),@cessOut)+N'/100)'
  752. +N' else (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct) end,Date_SaleBill From SaleBill'
  753. +N' Join SaleBillProduct On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill'
  754. +N' Join Product On Product.ID_Product=SaleBillProduct.ID_Product'
  755. +N' Join Location On Location.ID_Location=SaleBill.ID_Location'
  756. +N' Join Customer On Customer.ID_Customer=SaleBill.ID_Customer'
  757. +N' Left Join Employee On Employee.ID_Employee=SaleBill.ID_Principal'
  758. +N' Where SaleBill.ID_Assessor IS Not Null '
  759. if(@StartDate_SaleBill Is Not Null)
  760. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &gt;=DateAdd(day,DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N'),0)'
  761. if(@EndDate_SaleBill Is Not Null)
  762. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &lt;=DateAdd(day,(DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N')+1),0)'
  763. if(@StartNo_SaleBill Is Not Null)
  764. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  765. if(@EndNo_SaleBill Is Not Null)
  766. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  767. if(@StartNo_Customer Is Not Null)
  768. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  769. if(@EndNo_Customer Is Not Null)
  770. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  771. if(@StartNo_Principal Is Not Null)
  772. set @sqlCmd=@sqlCmd+N' And No_Employee &gt;= '+nchar(39)+@StartNo_Principal+nchar(39)
  773. if(@EndNo_Principal Is Not Null)
  774. set @sqlCmd=@sqlCmd+N' And No_Employee &lt;= '+nchar(39)+@EndNo_Principal+nchar(39)
  775. if(@StartNo_Location Is Not Null)
  776. set @sqlCmd=@sqlCmd+N' And No_Location &gt;= '+nchar(39)+@StartNo_Location +nchar(39)
  777. if(@EndNo_Location Is Not Null)
  778. set @sqlCmd=@sqlCmd+N' And No_Location &lt;= '+nchar(39)+@EndNo_Location+nchar(39)
  779. if(@Right Is Not Null)
  780. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  781. if(@Special=0)
  782. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  783. set @sqlCmd=@sqlCmd+N' Order By No_Product,No_SaleBill '
  784. EXECUTE sp_executesql @sqlCmd
  785. ">
  786. <Params>
  787. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  788. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  789. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  790. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  791. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  792. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  793. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  794. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  795. <Param name="@StartNo_Location" type="Location.No_Location" Index="8" />
  796. <Param name="@EndNo_Location" type="Location.No_Location" Index="9" />
  797. <Param name="@Right" type="SaleBill.ID_Customer" Index="10" />
  798. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="11" />
  799. </Params>
  800. <Tables>
  801. <Table name="FrmSalesDailyByProduct"/>
  802. </Tables>
  803. </SearchSalesDailyByProduct>
  804. <SearchSalesDailyByPrincipal CmdType="Text" CmdText="
  805. declare @sqlCmd nvarchar(4000)
  806. 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
  807. From SaleBill
  808. Join Location On Location.ID_Location=SaleBill.ID_Location
  809. Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  810. Left Join Employee On Employee.ID_Employee=SaleBill.ID_Principal
  811. Where SaleBill.ID_Assessor Is Not Null '
  812. if(@StartDate_SaleBill Is Not Null)
  813. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &gt;=DateAdd(day,DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N'),0)'
  814. if(@EndDate_SaleBill Is Not Null)
  815. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &lt;=DateAdd(day,(DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N')+1),0)'
  816. if(@StartNo_SaleBill Is Not Null)
  817. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  818. if(@EndNo_SaleBill Is Not Null)
  819. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  820. if(@StartNo_Customer Is Not Null)
  821. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  822. if(@EndNo_Customer Is Not Null)
  823. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  824. if(@StartNo_Principal Is Not Null)
  825. set @sqlCmd=@sqlCmd+N' And No_Employee &gt;= '+nchar(39)+@StartNo_Principal+nchar(39)
  826. if(@EndNo_Principal Is Not Null)
  827. set @sqlCmd=@sqlCmd+N' And No_Employee &lt;= '+nchar(39)+@EndNo_Principal+nchar(39)
  828. if(@StartNo_Location Is Not Null)
  829. set @sqlCmd=@sqlCmd+N' And No_Location &gt;= '+nchar(39)+@StartNo_Location +nchar(39)
  830. if(@EndNo_Location Is Not Null)
  831. set @sqlCmd=@sqlCmd+N' And No_Location &lt;= '+nchar(39)+@EndNo_Location+nchar(39)
  832. if(@Right Is Not Null)
  833. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  834. if(@Special=0)
  835. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  836. set @sqlCmd=@sqlCmd+N' Order By Principal_SaleBill,No_SaleBill '
  837. EXECUTE sp_executesql @sqlCmd
  838. ">
  839. <Params>
  840. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  841. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  842. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  843. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  844. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  845. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  846. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  847. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  848. <Param name="@StartNo_Location" type="Location.No_Location" Index="8" />
  849. <Param name="@EndNo_Location" type="Location.No_Location" Index="9" />
  850. <Param name="@Right" type="SaleBill.ID_Customer" Index="10" />
  851. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="11" />
  852. </Params>
  853. <Tables>
  854. <Table name="FrmSalesDailyByPrincipal"/>
  855. </Tables>
  856. </SearchSalesDailyByPrincipal>
  857. <SearchSalesDailyByLocation CmdType="Text" CmdText="
  858. declare @sqlCmd nvarchar(4000)
  859. 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
  860. From SaleBill
  861. Join Location On Location.ID_Location=SaleBill.ID_Location
  862. Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
  863. Left Join Employee On Employee.ID_Employee=SaleBill.ID_Principal
  864. Where SaleBill.ID_Assessor Is Not Null '
  865. if(@StartDate_SaleBill Is Not Null)
  866. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &gt;=DateAdd(day,DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@StartDate_SaleBill)+nchar(39)+N'),0)'
  867. if(@EndDate_SaleBill Is Not Null)
  868. set @sqlCmd=@sqlCmd+N' And Date_SaleBill &lt;=DateAdd(day,(DateDiff(day,0,'+nchar(39)+convert(nvarchar(64),@EndDate_SaleBill)+nchar(39)+N')+1),0)'
  869. if(@StartNo_SaleBill Is Not Null)
  870. set @sqlCmd=@sqlCmd+N' And No_SaleBill &gt;= '+nchar(39)+@StartNo_SaleBill+nchar(39)
  871. if(@EndNo_SaleBill Is Not Null)
  872. set @sqlCmd=@sqlCmd+N' And No_SaleBill &lt;= '+nchar(39)+@EndNo_SaleBill+nchar(39)
  873. if(@StartNo_Customer Is Not Null)
  874. set @sqlCmd=@sqlCmd+N' And No_Customer &gt;= '+nchar(39)+@StartNo_Customer+nchar(39)
  875. if(@EndNo_Customer Is Not Null)
  876. set @sqlCmd=@sqlCmd+N' And No_Customer &lt;= '+nchar(39)+@EndNo_Customer+nchar(39)
  877. if(@StartNo_Principal Is Not Null)
  878. set @sqlCmd=@sqlCmd+N' And No_Employee &gt;= '+nchar(39)+@StartNo_Principal+nchar(39)
  879. if(@EndNo_Principal Is Not Null)
  880. set @sqlCmd=@sqlCmd+N' And No_Employee &lt;= '+nchar(39)+@EndNo_Principal+nchar(39)
  881. if(@StartNo_Location Is Not Null)
  882. set @sqlCmd=@sqlCmd+N' And No_Location &gt;= '+nchar(39)+@StartNo_Location +nchar(39)
  883. if(@EndNo_Location Is Not Null)
  884. set @sqlCmd=@sqlCmd+N' And No_Location &lt;= '+nchar(39)+@EndNo_Location+nchar(39)
  885. if(@Right Is Not Null)
  886. set @sqlCmd=@sqlCmd+N' And Customer.ID_Creator= '+nchar(39)+Convert(nvarchar(64),@Right)+nchar(39)
  887. if(@Special=0)
  888. set @sqlCmd=@sqlCmd+N' And Special_SaleBill=0 '
  889. set @sqlCmd=@sqlCmd+N' Order By Name_Location,No_SaleBill '
  890. EXECUTE sp_executesql @sqlCmd
  891. ">
  892. <Params>
  893. <Param name="@StartDate_SaleBill" type="SaleBill.Date_SaleBill" Index="0" />
  894. <Param name="@EndDate_SaleBill" type="SaleBill.Date_SaleBill" Index="1" />
  895. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  896. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  897. <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="4" />
  898. <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="5" />
  899. <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
  900. <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
  901. <Param name="@StartNo_Location" type="Location.No_Location" Index="8" />
  902. <Param name="@EndNo_Location" type="Location.No_Location" Index="9" />
  903. <Param name="@Right" type="SaleBill.ID_Customer" Index="10" />
  904. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="11" />
  905. </Params>
  906. <Tables>
  907. <Table name="FrmSalesDailyByLocation"/>
  908. </Tables>
  909. </SearchSalesDailyByLocation>
  910. </Search>
  911. </Server>
  912. <Lables>
  913. </Lables>
  914. </Form>
  915. </Forms>