FrmPriceQueryBill.xml 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Forms>
  3. <Form Name="FrmPriceQueryBill">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @SetFlag=1;
  9. @viewMode=false;
  10. @Title="报价单";
  11. GetSchema();
  12. Search("SearchCessOut");
  13. @CessOut = #System.CessOut_SystemSetting / 100;
  14. Search("SearchPQDate");
  15. Search("SearchSystemSetting");
  16. Search("SearchProductWithNo","p");
  17. Search("SearchRelation","p","p");
  18. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  19. @PriceDecimal=#SystemSetting.PriceDecimal_SystemSetting;
  20. @AuditMode = #SystemSetting.PQAudit_FunctionSetting;
  21. ChangeMode("Search");
  22. dgProduct.NoMember="No_PriceQueryBillProduct";
  23. if(@AuditMode)
  24. {
  25. toolBar.VisibleAudit = false;
  26. toolBar.EnableAudit = false;
  27. }
  28. ]]>
  29. </Load>
  30. <Closing>
  31. </Closing>
  32. <Closed>
  33. </Closed>
  34. </Events>
  35. <Mode>
  36. <Search>
  37. <Lable name="Search" />
  38. </Search>
  39. <New>
  40. <Lable name="New" />
  41. </New>
  42. <View>
  43. <Lable name="View" />
  44. </View>
  45. <Modify>
  46. <Lable name="Modify" />
  47. </Modify>
  48. </Mode>
  49. <Controls>
  50. <IKDateTimePicker name="dtpDate" DataSource="PriceQueryBill.Date_PriceQueryBill"/>
  51. <IKTextButton name="tbNo" DataSource="PriceQueryBill.No_PriceQueryBill">
  52. <Events>
  53. <Enter>
  54. <![CDATA[
  55. if(tbNo.ReadOnly == false)
  56. {
  57. if(tbNo.CValue != StringEmpty())
  58. {
  59. UpdateForm(false, "");
  60. if(Search("SearchPriceQueryBillWithNo", tbNo.CValue))
  61. {
  62. if(!Search("SearchCustomersIsInRegionalLeader",#PriceQueryBill.No_Customer, GetCurrentUser()))
  63. {
  64. MessageBox("你与客户不在同一个区域,不能查看!");
  65. ChangeMode("Search");
  66. return;
  67. }
  68. if(GetRight("客户基本资料","全权查看")||Equals(GetLoginUserID(),#PriceQueryBill.CustomerCreator)&&(GetFieldRight(@Title,"最低报价","查看")||!#PriceQueryBill.Special_PriceQueryBill))
  69. ChangeMode("View");
  70. else
  71. {
  72. @EnterNo=tbNo.CValue;
  73. ChangeMode("Search");
  74. tbNo.CValue=@EnterNo;
  75. MessageBox("你没有查看该单据资料的权限!",@Title);
  76. return;
  77. }
  78. }
  79. else
  80. {
  81. MessageBox("该报价单不存在!",@Title);
  82. }
  83. }
  84. else
  85. {
  86. MessageBox("请输入报价单号!",@Title);
  87. }
  88. }
  89. ]]>
  90. <Lable name="CountSum" />
  91. </Enter>
  92. <Click>
  93. ShowSearchBox("BillSearch","NODEPOT", "tbNo",tbNo.CValue);
  94. </Click>
  95. </Events>
  96. </IKTextButton>
  97. <IKDateTimePicker name="dtpQueryDate" DataSource="PriceQueryBill.QueryDate_PriceQueryBill"/>
  98. <IKTextButton name="tbCustomerNo" DataSource="PriceQueryBill.No_Customer">
  99. <Events>
  100. <Enter>
  101. <![CDATA[
  102. if (tbCustomerNo.ReadOnly == false)
  103. {
  104. UpdateForm(false, "");
  105. if (tbCustomerNo.CValue == "" || !Search("SearchCustomerWithNo", tbCustomerNo.CValue))
  106. {
  107. if (tbCustomerNo.CValue == "")
  108. {
  109. MessageBox("请输入客户编号!", @Title);
  110. }
  111. else
  112. {
  113. MessageBox("该客户不存在!",@Title);
  114. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  115. if(@temp != "")
  116. {
  117. tbCustomerNo.CValue = @temp;
  118. ActiveControlEvent("tbCustomerNo", "Enter");
  119. }
  120. }
  121. }
  122. else
  123. {
  124. if (!Search("SearchCustomersIsInRegionalLeader",tbCustomerNo.CValue, GetCurrentUser()))
  125. {
  126. MessageBox("你与客户不在同一个区域,不能填单!");
  127. tbCustomerNo.Text = "";
  128. return;
  129. }
  130. if (!Equals(#Customer.SuspendDate_Customer,DBNull()))
  131. {
  132. MessageBox("该客户已停用!",@Title);
  133. }
  134. #PriceQueryBill.ID_Customer = #Customer.ID_Customer;
  135. #PriceQueryBill.Discount_PriceQueryBill = #Customer.LastDiscount_Customer;
  136. #PriceQueryBill.Name_Customer = #Customer.Name_Customer;
  137. #PriceQueryBill.ShortName_Customer = #Customer.ShortName_Customer;
  138. #PriceQueryBill.Type_Customer = #Customer.Type_Customer;
  139. #PriceQueryBill.ToGet_PriceQueryBill = #Customer.ToGetBalance_Customer;
  140. #PriceQueryBill.PostalCode_Customer = #Customer.PostalCode_Customer;
  141. #PriceQueryBill.SendAddr_PriceQueryBill = #Customer.SendAddr_Customer;
  142. #PriceQueryBill.TaxCurrency_PriceQueryBill = #Customer.LastTax_Customer;
  143. #PriceQueryBill.ID_Principal = #Customer.LastPrincipal_Customer;
  144. #PriceQueryBill.Principal_PriceQueryBill = #Customer.Name_Employee;
  145. #PriceQueryBill.No_Principal = #Customer.No_Employee;
  146. Empty("#ReportComment");
  147. Search("SearchTypeComment",#PriceQueryBill.ID_Customer);
  148. MergeTable("#TypeComment","#ReportComment");
  149. if (RowCount("Linkman") > 0)
  150. {
  151. #PriceQueryBill.Name_Linkman = #Linkman.Name_Linkman;
  152. }
  153. else
  154. {
  155. #PriceQueryBill.Name_Linkman = DBNull();
  156. }
  157. if (RowCount("Telephone") > 0)
  158. {
  159. #PriceQueryBill.Name_Telephone = #Telephone.No_Telephone;
  160. }
  161. else
  162. {
  163. #PriceQueryBill.Name_Telephone = DBNull();
  164. }
  165. if (RowCount("Fax") > 0)
  166. {
  167. #PriceQueryBill.Fax_Telephone = #Fax.No_Fax;
  168. }
  169. else
  170. {
  171. #PriceQueryBill.Fax_Telephone = DBNull();
  172. }
  173. }
  174. UpdateForm(true, "");
  175. }
  176. ]]>
  177. <Lable name="ChangeDiscount" />
  178. </Enter>
  179. <Click>
  180. <![CDATA[
  181. if (tbCustomerNo.ReadOnly == false)
  182. {
  183. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo.CValue);
  184. if( @temp == "" )
  185. return;
  186. tbCustomerNo.CValue = @temp;
  187. ActiveControlEvent("tbCustomerNo", "Enter");
  188. }
  189. ]]>
  190. </Click>
  191. </Events>
  192. </IKTextButton>
  193. <IKTextBox name="txtCustomerShortName" DataSource="PriceQueryBill.ShortName_Customer"></IKTextBox>
  194. <IKDateTimePicker name="dtpValidDate" DataSource="PriceQueryBill.ValidDate_PriceQueryBill"/>
  195. <IKTextBox name="tbToGet" DataSource="PriceQueryBill.ToGet_PriceQueryBill"></IKTextBox>
  196. <IKNumericTextBox name="ntbDiscount" DataSource="PriceQueryBill.Discount_PriceQueryBill">
  197. <Events>
  198. <Enter>
  199. UpdateForm(false, "ntbDiscount");
  200. <Lable name="ChangeDiscount" />
  201. </Enter>
  202. </Events>
  203. </IKNumericTextBox>
  204. <IKComboBoxEx name="cbTaxCurrency" DisplaySource="PriceQueryBill.TaxCurrency_PriceQueryBill">
  205. <Events>
  206. <SelectedIndexChanged>
  207. if(!@viewMode)
  208. {
  209. <Lable name="CountPrice"/>
  210. }
  211. <Lable name="CountSum" />
  212. </SelectedIndexChanged>
  213. </Events>
  214. </IKComboBoxEx>
  215. <IKComboBoxEx name="cbCurrency" DisplaySource="PriceQueryBill.Currency_PriceQueryBill" DataSource="PriceQueryBill"></IKComboBoxEx>
  216. <IKComboBoxEx name="cbPrincipal" ValueSource="PriceQueryBill.ID_Principal" DisplaySource="PriceQueryBill.Principal_PriceQueryBill" NoSource="PriceQueryBill.No_Principal" DataSource="Principal" ValueMember="ID_Employee" DisplayMember="Principal_PriceQueryBill" NoMember="No_Principal">
  217. <Events>
  218. <Reload>
  219. UpdateForm(false, "cbPrincipal");
  220. Search("SearchAllPrincipal");
  221. UpdateForm(true, "cbPrincipal");
  222. </Reload>
  223. </Events>
  224. </IKComboBoxEx>
  225. <IKTextBox name="txtMaker" DataSource="PriceQueryBill.Name_Creator"></IKTextBox>
  226. <IKTextBox name="txtAudi" DataSource="PriceQueryBill.Name_Assessor"></IKTextBox>
  227. <IKDateTimeText name="dtAssessDate" DataSource="PriceQueryBill.AssessDate_PriceQueryBill"></IKDateTimeText>
  228. <IKTextBox name="txtLastModUser" DataSource="PriceQueryBill.LastModUserName"></IKTextBox>
  229. <IKDateTimeText name="dtLastModDate" DataSource="PriceQueryBill.LastModDate_PriceQueryBill"></IKDateTimeText>
  230. <IKTextBox name="txtCustomerName" DataSource="PriceQueryBill.Name_Customer"></IKTextBox>
  231. <IKTextBox name="txtCustomerType" DataSource="PriceQueryBill.Type_Customer"></IKTextBox>
  232. <IKComboBoxEx name="cbLinkman" DisplaySource="PriceQueryBill.Name_Linkman" DataSource="Linkman" DisplayMember="Name_Linkman">
  233. <Events>
  234. <Reload>
  235. UpdateForm(false, "cbLinkman");
  236. Search("SearchLinkman", tbCustomerNo.CValue);
  237. UpdateForm(true, "cbLinkman");
  238. </Reload>
  239. </Events>
  240. </IKComboBoxEx>
  241. <IKTextBox name="cbTele" DisplaySource="PriceQueryBill.Name_Telephone" DataSource="Telephone" DisplayMember="No_Telephone">
  242. <Events>
  243. <Reload>
  244. UpdateForm(false, "cbTele");
  245. Search("SearchTele", tbCustomerNo.CValue);
  246. UpdateForm(true, "cbTele");
  247. </Reload>
  248. </Events>
  249. </IKTextBox>
  250. <IKTextBox name="cbFax" DisplaySource="PriceQueryBill.Fax_Telephone" DataSource="Fax" DisplayMember="No_Fax">
  251. <Events>
  252. <Reload>
  253. UpdateForm(false, "cbFax");
  254. Search("SearchFax", tbCustomerNo.CValue);
  255. UpdateForm(true, "cbFax");
  256. </Reload>
  257. </Events>
  258. </IKTextBox>
  259. <IKTextBox name="txtSendAddr" DataSource="PriceQueryBill.SendAddr_PriceQueryBill"></IKTextBox>
  260. <IKNumericTextBox name="ntbNumSum" DataSource="PriceQueryBill.NumSum"></IKNumericTextBox>
  261. <IKNumericTextBox name="ntbTaxSum" DataSource="PriceQueryBill.TaxAmount_PriceQueryBill"></IKNumericTextBox>
  262. <IKNumericTextBox name="ntbMoneySum" DataSource="PriceQueryBill.GoodsAmount_PriceQueryBill"></IKNumericTextBox>
  263. <IKNumericTextBox name="ntbSum" DataSource="PriceQueryBill.Amount_PriceQueryBill"></IKNumericTextBox>
  264. <IKCheckBox name="ckSpecial" DataSource="PriceQueryBill.Special_PriceQueryBill"/>
  265. <IKDataGridEx name="dgProduct" DataSource="PriceQueryBillProduct" TableStyleIndex="0">
  266. <DataColumn Index="0" DataSource="PriceQueryBillProduct.No_PriceQueryBillProduct" />
  267. <DataColumn Index="1" DataSource="PriceQueryBillProduct.No_Product" >
  268. <IKDataGridTextButtonColumn>
  269. <Events>
  270. <Click>
  271. @SetFlag=1;
  272. ShowSearchBox("ProductSearch","INFOMATION",#PriceQueryBillProduct.No_Product);
  273. </Click>
  274. <SetFlagBeforeClick>
  275. @SetFlag=0;
  276. </SetFlagBeforeClick>
  277. </Events>
  278. </IKDataGridTextButtonColumn>
  279. </DataColumn>
  280. <DataColumn Index="2" DataSource="PriceQueryBillProduct.Name_Product" />
  281. <DataColumn Index="3" DataSource="PriceQueryBillProduct.Quantity_PriceQueryBillProduct" />
  282. <DataColumn Index="4" DataSource="PriceQueryBillProduct.Unit_Product" />
  283. <DataColumn Index="5" DataSource="PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct" />
  284. <DataColumn Index="6" DataSource="PriceQueryBillProduct.Discount_PriceQueryBillProduct" />
  285. <DataColumn Index="7" DataSource="PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" />
  286. <DataColumn Index="8" DataSource="PriceQueryBillProduct.Amount_PriceQueryBillProduct" />
  287. <DataColumn Index="9" DataSource="PriceQueryBillProduct.Comment_PriceQueryBillProduct" />
  288. <DataColumn Index="10" DataSource="PriceQueryBillProduct.AvailableQty_ProductStocks" />
  289. </IKDataGridEx>
  290. <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
  291. <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
  292. </IKDataGridEx>
  293. <IKDataGridEx name="dgReport" DataSource="ReportComment" TableStyleIndex="0">
  294. <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
  295. </IKDataGridEx>
  296. <IKFormToolBar name="toolBar">
  297. <Events>
  298. <ClickFirst>
  299. if(Search("SearchPriceQueryBillFirst",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"最低报价","查看"),GetCurrentUser()))
  300. {
  301. ChangeMode("View");
  302. <Lable name="CountSum" />
  303. }
  304. </ClickFirst>
  305. <ClickPrev>
  306. if (Search("SearchPriceQueryBillPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"最低报价","查看"),GetCurrentUser()))
  307. {
  308. ChangeMode("View");
  309. <Lable name="CountSum" />
  310. }
  311. </ClickPrev>
  312. <ClickNext>
  313. if (Search("SearchPriceQueryBillNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"最低报价","查看"),GetCurrentUser()))
  314. {
  315. ChangeMode("View");
  316. <Lable name="CountSum" />
  317. }
  318. </ClickNext>
  319. <ClickLast>
  320. if (Search("SearchPriceQueryBillLast",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetFieldRight(@Title,"最低报价","查看"),GetCurrentUser()))
  321. {
  322. ChangeMode("View");
  323. <Lable name="CountSum" />
  324. }
  325. </ClickLast>
  326. <ClickEmpty>
  327. ChangeMode("Search");
  328. </ClickEmpty>
  329. <ClickNew>
  330. <![CDATA[
  331. @NextNo = GetNextAutoNumber(true);
  332. if (!Equals(@NextNo, ""))
  333. {
  334. ChangeMode("New");
  335. #PriceQueryBill.No_PriceQueryBill = @NextNo;
  336. UpdateForm(true, "tbNo");
  337. }
  338. ]]>
  339. </ClickNew>
  340. <ClickSubmit>
  341. <Lable name="SubmitButtonClick" />
  342. if(@AuditMode)
  343. {
  344. <Lable name = "AuditLable"/>
  345. }
  346. </ClickSubmit>
  347. <ClickModify>
  348. Search("SearchPrincipal", tbCustomerNo.CValue);
  349. ChangeMode("Modify");
  350. <Lable name="CountSum" />
  351. <Lable name="AvailableQty_ProductStocks"/>
  352. </ClickModify>
  353. <ClickDelete>
  354. Delete();
  355. ChangeMode("Search");
  356. </ClickDelete>
  357. <ClickPrint>
  358. ShowPrintBox("BillSearch",#PriceQueryBill.No_PriceQueryBill,#PriceQueryBill.No_PriceQueryBill);
  359. </ClickPrint>
  360. <ClickAudit>
  361. if(@AuditMode)
  362. return;
  363. <Lable name = "AuditLable"/>
  364. </ClickAudit>
  365. <ClickUnAudit>
  366. BeginUnAudit();
  367. #PriceQueryBill.ID_Assessor = DBNull();
  368. #PriceQueryBill.Name_Assessor = "";
  369. UnAudit();
  370. ChangeMode("View");
  371. EndUnAudit();
  372. <Lable name="CountSum" />
  373. </ClickUnAudit>
  374. <ClickImport>
  375. ;
  376. </ClickImport>
  377. <ClickExport>
  378. ;
  379. </ClickExport>
  380. <ClickClose>
  381. ;
  382. </ClickClose>
  383. <ClickExpand>
  384. if(toolBar.ExpandForm==true)
  385. {
  386. pnRight.Visible=true;<!--PanelRight is not existed-->
  387. }
  388. else
  389. {
  390. pnRight.Visible=false;
  391. }
  392. </ClickExpand>
  393. <ClickImportItem>
  394. <![CDATA[
  395. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="本单据")
  396. {
  397. ShowSearchBox("BillSearch","INFOMATIONCOPYNODEPOT","SearchPriceQueryBillWithNo1",false,"#PriceQueryBill.ID_PriceQueryBill","#PriceQueryBill.Date_PriceQueryBill","#PriceQueryBill.No_PriceQueryBill","#PriceQueryBill.Name_Assessor","#PriceQueryBill.ID_Assessor","#PriceQueryBill.LastModUserName","PriceQueryBill.LastModUser_PriceQueryBill","#PriceQueryBill.Name_Creator","#PriceQueryBill.ID_Creator","#PriceQueryBillProduct.ID_PriceQueryBillProduct","#BillComment.ID_BillComment","#ReportComment.ID_ReportComment",RowCount("#PriceQueryBillProduct"));
  398. }
  399. ]]>
  400. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  401. <Lable name="CountSum" />
  402. </ClickImportItem>
  403. <ClickExportItem>
  404. if(toolBar.MenuItemText=="销货单")
  405. {
  406. ExportBillProductStart("#SaleBillProduct.Type_FromBill",23,"#SaleBillProduct.Name_BillType","报价单","#SaleBillProduct.No_FromBill",#PriceQueryBill.No_PriceQueryBill,"#SaleBill.No_Customer",#PriceQueryBill.No_Customer,"#SaleBill.TaxCurrency_SaleBill",#PriceQueryBill.TaxCurrency_PriceQueryBill);
  407. ExportBillProduct("dgProduct","#PriceQueryBillProduct","#SaleBillProduct.No_FromBillProduct","#PriceQueryBillProduct.No_PriceQueryBillProduct");
  408. }
  409. else if(toolBar.MenuItemText=="采购订单")
  410. {
  411. ExportBillProductStart("#PurchaseOrderBill.No_Supplier",#PriceQueryBill.No_Customer,"#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct",#PriceQueryBill.No_PriceQueryBill,"#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill",#PriceQueryBill.TaxCurrency_PriceQueryBill);
  412. ExportBillProduct("dgProduct","#PriceQueryBillProduct","#PurchaseOrderBillProduct.No_Product","#PriceQueryBillProduct.No_Product");
  413. }
  414. else if(toolBar.MenuItemText=="询价单")
  415. {
  416. ExportBillProductStart("#PurchaseQueryBill.No_Supplier",#PriceQueryBill.No_Customer,"#PurchaseQueryBillProduct.Comment_PurchaseQueryBillProduct",#PriceQueryBill.No_PriceQueryBill,"#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill",#PriceQueryBill.TaxCurrency_PriceQueryBill);
  417. ExportBillProduct("dgProduct","#PriceQueryBillProduct","#PurchaseQueryBillProduct.No_Product","#PriceQueryBillProduct.No_Product");
  418. }
  419. <!--初始化目标数据-->
  420. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  421. </ClickExportItem>
  422. </Events>
  423. </IKFormToolBar>
  424. </Controls>
  425. <Tables>
  426. <Table name="PriceQueryBillProduct">
  427. <Events>
  428. <ColumnsChanged>
  429. <No_Product>
  430. <![CDATA[
  431. if(@SetFlag==0)
  432. {
  433. return;
  434. }
  435. if (!Equals(#PriceQueryBillProduct.No_Product,"") && !Equals(#PriceQueryBillProduct.No_Product,DBNull()))
  436. {
  437. if (Search("SearchProductWithNo",#PriceQueryBillProduct.No_Product))
  438. {
  439. if(!Equals(#Product.SuspendDate_Product,DBNull()))
  440. {
  441. MessageBox("该产品已停用!",@Title);
  442. }
  443. #PriceQueryBillProduct.ID_Product = #Product.ID_Product;
  444. #PriceQueryBillProduct.Name_Product = #Product.Name_Product;
  445. #PriceQueryBillProduct.Unit_Product = #Product.Unit_Product;
  446. #PriceQueryBillProduct.AvailableQty_ProductStocks = #Product.AvailableQty_ProductStocks;
  447. if(cbTaxCurrency.Text=="内含")
  448. #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct=FormatNumber(#Product.Price_Product*(1+@CessOut),@PriceDecimal);
  449. else
  450. #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct=#Product.Price_Product;
  451. if(#PriceQueryBillProduct.Discount_PriceQueryBillProduct!=0)
  452. {
  453. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*#PriceQueryBillProduct.Discount_PriceQueryBillProduct/100,@PriceDecimal);
  454. }
  455. else
  456. {
  457. if(Search("SearchRelation",#PriceQueryBillProduct.No_Product,tbCustomerNo.CValue))
  458. {
  459. if(cbTaxCurrency.Text=="内含")
  460. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
  461. else
  462. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = #PriceReference.UnitPrice_PriceReference;
  463. if(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct==0)
  464. #PriceQueryBillProduct.Discount_PriceQueryBillProduct=100;
  465. else
  466. #PriceQueryBillProduct.Discount_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct/#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*100,@PriceDecimal);
  467. }
  468. else
  469. {
  470. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct;
  471. #PriceQueryBillProduct.Discount_PriceQueryBillProduct=100;
  472. }
  473. }
  474. #PriceQueryBillProduct.Amount_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct * #PriceQueryBillProduct.Quantity_PriceQueryBillProduct,#SystemSetting.PriceDecimal_SystemSetting);
  475. }
  476. else
  477. {
  478. MessageBox("该产品不存在!",@Title);
  479. #PriceQueryBillProduct.ID_Product = GuidEmpty();
  480. #PriceQueryBillProduct.Name_Product = "";
  481. #PriceQueryBillProduct.Unit_Product = "";
  482. #PriceQueryBillProduct.Quantity_PriceQueryBillProduct = 0;
  483. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = 0;
  484. #PriceQueryBillProduct.Amount_PriceQueryBillProduct = 0;
  485. @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PriceQueryBillProduct.No_Product);
  486. if(@temp != "")
  487. {
  488. ResumeColumnEvent("#PriceQueryBillProduct.No_Product");
  489. #PriceQueryBillProduct.No_Product = @temp;
  490. ClearColumnEvent();
  491. }
  492. }
  493. }
  494. else
  495. {
  496. #PriceQueryBillProduct.ID_Product = GuidEmpty();
  497. #PriceQueryBillProduct.Name_Product = "";
  498. #PriceQueryBillProduct.Unit_Product = "";
  499. #PriceQueryBillProduct.Quantity_PriceQueryBillProduct = 0;
  500. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = 0;
  501. #PriceQueryBillProduct.Amount_PriceQueryBillProduct = 0;
  502. }
  503. ]]>
  504. <Lable name="CountSum" />
  505. </No_Product>
  506. <Quantity_PriceQueryBillProduct>
  507. #PriceQueryBillProduct.Quantity_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.Quantity_PriceQueryBillProduct, @PriceDecimal);
  508. #PriceQueryBillProduct.Amount_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct * #PriceQueryBillProduct.Quantity_PriceQueryBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
  509. <Lable name="CountSum" />
  510. </Quantity_PriceQueryBillProduct>
  511. <UnitPrice_PriceQueryBillProduct>
  512. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct, @PriceDecimal);
  513. if(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct==0)
  514. #PriceQueryBillProduct.Discount_PriceQueryBillProduct=100;
  515. else
  516. #PriceQueryBillProduct.Discount_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct/#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*100,@PriceDecimal);
  517. #PriceQueryBillProduct.Amount_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct * #PriceQueryBillProduct.Quantity_PriceQueryBillProduct, #SystemSetting.PriceDecimal_SystemSetting);
  518. <Lable name="CountSum" />
  519. </UnitPrice_PriceQueryBillProduct>
  520. <Discount_PriceQueryBillProduct>
  521. if(#PriceQueryBillProduct.Discount_PriceQueryBillProduct==0)
  522. {
  523. if(Search("SearchRelation",#PriceQueryBillProduct.No_Product,tbCustomerNo.CValue))
  524. {
  525. if(cbTaxCurrency.Text=="内含")
  526. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct=#PriceReference.UnitPriceWithTax_PriceReference;
  527. else
  528. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = #PriceReference.UnitPrice_PriceReference;
  529. if(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct==0)
  530. #PriceQueryBillProduct.Discount_PriceQueryBillProduct=100;
  531. else
  532. #PriceQueryBillProduct.Discount_PriceQueryBillProduct =FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct/#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*100,@PriceDecimal);
  533. }
  534. else
  535. {
  536. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct;
  537. #PriceQueryBillProduct.Discount_PriceQueryBillProduct=100;
  538. }
  539. }
  540. else
  541. {
  542. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*#PriceQueryBillProduct.Discount_PriceQueryBillProduct/100,@PriceDecimal);
  543. }
  544. #PriceQueryBillProduct.Amount_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct * #PriceQueryBillProduct.Quantity_PriceQueryBillProduct,#SystemSetting.PriceDecimal_SystemSetting);
  545. <Lable name="CountSum" />
  546. </Discount_PriceQueryBillProduct>
  547. </ColumnsChanged>
  548. <RowDeleted>
  549. <Lable name="CountSum" />
  550. </RowDeleted>
  551. </Events>
  552. </Table>
  553. </Tables>
  554. <LockInfomation LockID="ID_PriceQueryBill" LockNO="No_PriceQueryBill" LockSearchFunction="SearchPriceQueryBillWithNo" LockAudit="ID_Assessor"/>
  555. <LogInfomation LogNO="#PriceQueryBill.No_PriceQueryBill" RecordFormField="" RecordDataGridField=""/>
  556. <ChildForms>
  557. <ChildForm name="BillSearch" DataSource="PriceQueryBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="SearchPriceQueryBillWithNo">
  558. <DataColumn Index="0" MappingName="#PriceQueryBill.No_PriceQueryBill" HeaderText="报价单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  559. <DataColumn Index="1" MappingName="#PriceQueryBill.Date_PriceQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  560. <DataColumn Index="2" MappingName="#PriceQueryBill.No_Customer" HeaderText="客户编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  561. <DataColumn Index="3" MappingName="#PriceQueryBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  562. <DataColumn Index="4" MappingName="#PriceQueryBill.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  563. <DataColumn Index="5" MappingName="#PriceQueryBill.Principal_PriceQueryBill" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  564. <DataColumn Index="6" MappingName="#PriceQueryBill.QueryDate_PriceQueryBill" HeaderText="询价日期" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  565. <DataColumn Index="7" MappingName="#PriceQueryBill.ValidDate_PriceQueryBill" HeaderText="有效期至" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  566. <DataColumn Index="8" MappingName="#PriceQueryBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  567. <DataColumn Index="9" MappingName="#PriceQueryBill.Name_Telephone" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  568. <DataColumn Index="10" MappingName="#PriceQueryBill.Fax_Telephone" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  569. </ChildForm>
  570. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  571. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  572. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  573. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  574. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  575. <DataColumn Index="4" MappingName="#Customer.No_RegionalLeader" HeaderText="所属区域" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  576. <DataColumn Index="5" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  577. <DataColumn Index="6" MappingName="#Customer.Zone_Customer" HeaderText="地区" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  578. <DataColumn Index="7" MappingName="#Customer.SendAddr_Customer" HeaderText="送货地址" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  579. <DataColumn Index="8" MappingName="#Customer.Name_Linkman" HeaderText="主要联系人" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  580. <DataColumn Index="9" MappingName="#Customer.No_Telephone" HeaderText="客户电话" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  581. <DataColumn Index="10" MappingName="#Customer.No_Fax" HeaderText="传真" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  582. </ChildForm>
  583. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PriceQueryBillProduct" ShowCheckBox="true">
  584. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PriceQueryBillProduct.No_Product"/>
  585. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  586. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  587. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  588. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  589. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  590. </ChildForm>
  591. <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  592. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  593. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  594. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品类型" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  595. <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  596. <DataColumn Index="4" MappingName="#Product.LowSalePrice_Product" HeaderText="最低售价" Width="120" ColumnType="IKDataGridTextBoxColumn" Format="F2"/>
  597. <DataColumn Index="5" MappingName="#Product.SafetyQty_Product" HeaderText="安全存量" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  598. </ChildForm>
  599. </ChildForms>
  600. <FormatString>
  601. <Format name="SearchCustomerCondition">
  602. if(GetRight("客户基本资料","全权查看"))
  603. {
  604. FormatString("");
  605. }
  606. else
  607. {
  608. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  609. }
  610. </Format>
  611. <Format name="SearchBillCondition">
  612. if(GetRight("客户基本资料","全权查看"))
  613. {
  614. FormatString("");
  615. }
  616. else
  617. {
  618. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  619. }
  620. </Format>
  621. </FormatString>
  622. </Client>
  623. <Server>
  624. <Tables>
  625. <Table name="PriceQueryBill" Type="Parent">
  626. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  627. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  628. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill,
  629. CONVERT(decimal(18,6), 0) AS NumSum
  630. FROM PriceQueryBill
  631. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  632. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  633. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  634. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  635. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal" />
  636. <New CmdType="Text" CmdText="INSERT INTO PriceQueryBill(ID_PriceQueryBill,
  637. No_PriceQueryBill,
  638. Date_PriceQueryBill,
  639. QueryDate_PriceQueryBill,
  640. ID_Customer,
  641. ValidDate_PriceQueryBill,
  642. ToGet_PriceQueryBill,
  643. TaxCurrency_PriceQueryBill,
  644. Currency_PriceQueryBill,
  645. ID_Principal,
  646. Name_Linkman,
  647. Name_Telephone,
  648. Fax_Telephone,
  649. SendAddr_PriceQueryBill,
  650. ID_Creator,
  651. CreateDate_PriceQueryBill,
  652. Discount_PriceQueryBill,
  653. Amount_PriceQueryBill,
  654. GoodsAmount_PriceQueryBill,
  655. TaxAmount_PriceQueryBill,
  656. Special_PriceQueryBill
  657. )
  658. VALUES( @ID_PriceQueryBill,
  659. @No_PriceQueryBill,
  660. @Date_PriceQueryBill,
  661. @QueryDate_PriceQueryBill,
  662. @ID_Customer,
  663. @ValidDate_PriceQueryBill,
  664. @ToGet_PriceQueryBill,
  665. @TaxCurrency_PriceQueryBill,
  666. @Currency_PriceQueryBill,
  667. @ID_Principal,
  668. @Name_Linkman,
  669. @Name_Telephone,
  670. @Fax_Telephone,
  671. @SendAddr_PriceQueryBill,
  672. @ID_Creator,
  673. @CreateDate_PriceQueryBill,
  674. @Discount_PriceQueryBill,
  675. @Amount_PriceQueryBill,
  676. @GoodsAmount_PriceQueryBill,
  677. @TaxAmount_PriceQueryBill,
  678. @Special_PriceQueryBill
  679. )
  680. UPDATE Customer SET Customer.LastPrincipal_Customer=@ID_Principal, Customer.LastDiscount_Customer = @Discount_PriceQueryBill, Customer.LastTax_Customer = @TaxCurrency_PriceQueryBill WHERE Customer.ID_Customer = @ID_Customer">
  681. <Params>
  682. <Param name="@ID_PriceQueryBill" type="PriceQueryBill.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  683. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" sourceColumn="No_PriceQueryBill" />
  684. <Param name="@Date_PriceQueryBill" type="PriceQueryBill.Date_PriceQueryBill" sourceColumn="Date_PriceQueryBill" />
  685. <Param name="@QueryDate_PriceQueryBill" type="PriceQueryBill.QueryDate_PriceQueryBill" sourceColumn="QueryDate_PriceQueryBill" />
  686. <Param name="@ID_Customer" type="PriceQueryBill.ID_Customer" sourceColumn="ID_Customer" />
  687. <Param name="@ValidDate_PriceQueryBill" type="PriceQueryBill.ValidDate_PriceQueryBill" sourceColumn="ValidDate_PriceQueryBill" />
  688. <Param name="@ToGet_PriceQueryBill" type="PriceQueryBill.ToGet_PriceQueryBill" sourceColumn="ToGet_PriceQueryBill" />
  689. <Param name="@Name_Linkman" type="PriceQueryBill.Name_Linkman" sourceColumn="Name_Linkman" />
  690. <Param name="@Name_Telephone" type="PriceQueryBill.Name_Telephone" sourceColumn="Name_Telephone" />
  691. <Param name="@Fax_Telephone" type="PriceQueryBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
  692. <Param name="@SendAddr_PriceQueryBill" type="PriceQueryBill.SendAddr_PriceQueryBill" sourceColumn="SendAddr_PriceQueryBill" />
  693. <Param name="@TaxCurrency_PriceQueryBill" type="PriceQueryBill.TaxCurrency_PriceQueryBill" sourceColumn="TaxCurrency_PriceQueryBill" />
  694. <Param name="@Currency_PriceQueryBill" type="PriceQueryBill.Currency_PriceQueryBill" sourceColumn="Currency_PriceQueryBill" />
  695. <Param name="@ID_Principal" type="PriceQueryBill.ID_Principal" sourceColumn="ID_Principal" />
  696. <Param name="@ID_Creator" type="PriceQueryBill.ID_Creator" sourceColumn="ID_Creator" />
  697. <Param name="@CreateDate_PriceQueryBill" type="PriceQueryBill.CreateDate_PriceQueryBill" sourceColumn="CreateDate_PriceQueryBill" />
  698. <Param name="@Discount_PriceQueryBill" type="PriceQueryBill.Discount_PriceQueryBill" sourceColumn="Discount_PriceQueryBill" />
  699. <Param name="@Amount_PriceQueryBill" type="PriceQueryBill.Amount_PriceQueryBill" sourceColumn="Amount_PriceQueryBill" />
  700. <Param name="@GoodsAmount_PriceQueryBill" type="PriceQueryBill.GoodsAmount_PriceQueryBill" sourceColumn="GoodsAmount_PriceQueryBill" />
  701. <Param name="@TaxAmount_PriceQueryBill" type="PriceQueryBill.TaxAmount_PriceQueryBill" sourceColumn="TaxAmount_PriceQueryBill" />
  702. <Param name="@Special_PriceQueryBill" type="PriceQueryBill.Special_PriceQueryBill" sourceColumn="Special_PriceQueryBill" />
  703. </Params>
  704. </New>
  705. <Update CmdType="Text" CmdText="UPDATE PriceQueryBill
  706. SET No_PriceQueryBill=@No_PriceQueryBill,
  707. Date_PriceQueryBill=@Date_PriceQueryBill,
  708. QueryDate_PriceQueryBill=@QueryDate_PriceQueryBill,
  709. ID_Customer=@ID_Customer,
  710. ValidDate_PriceQueryBill=@ValidDate_PriceQueryBill,
  711. ToGet_PriceQueryBill=@ToGet_PriceQueryBill,
  712. TaxCurrency_PriceQueryBill=@TaxCurrency_PriceQueryBill,
  713. Currency_PriceQueryBill=@Currency_PriceQueryBill,
  714. ID_Principal=@ID_Principal,
  715. Name_Linkman=@Name_Linkman,
  716. Name_Telephone=@Name_Telephone,
  717. Fax_Telephone=@Fax_Telephone,
  718. SendAddr_PriceQueryBill=@SendAddr_PriceQueryBill,
  719. ID_Creator=@ID_Creator,
  720. ID_Assessor=@ID_Assessor,
  721. AssessDate_PriceQueryBill=@AssessDate_PriceQueryBill,
  722. CreateDate_PriceQueryBill=@CreateDate_PriceQueryBill,
  723. LastModUser_PriceQueryBill=@LastModUser_PriceQueryBill,
  724. LastModDate_PriceQueryBill=@LastModDate_PriceQueryBill,
  725. Discount_PriceQueryBill=@Discount_PriceQueryBill,
  726. Amount_PriceQueryBill=@Amount_PriceQueryBill,
  727. GoodsAmount_PriceQueryBill=@GoodsAmount_PriceQueryBill,
  728. TaxAmount_PriceQueryBill=@TaxAmount_PriceQueryBill,
  729. Special_PriceQueryBill=@Special_PriceQueryBill
  730. WHERE ID_PriceQueryBill=@ID_PriceQueryBill
  731. UPDATE Customer SET Customer.LastPrincipal_Customer=@ID_Principal, Customer.LastDiscount_Customer = @Discount_PriceQueryBill, Customer.LastTax_Customer = @TaxCurrency_PriceQueryBill WHERE Customer.ID_Customer = @ID_Customer">
  732. <Params>
  733. <Param name="@ID_PriceQueryBill" type="PriceQueryBill.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  734. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" sourceColumn="No_PriceQueryBill" />
  735. <Param name="@Date_PriceQueryBill" type="PriceQueryBill.Date_PriceQueryBill" sourceColumn="Date_PriceQueryBill" />
  736. <Param name="@QueryDate_PriceQueryBill" type="PriceQueryBill.QueryDate_PriceQueryBill" sourceColumn="QueryDate_PriceQueryBill" />
  737. <Param name="@ID_Customer" type="PriceQueryBill.ID_Customer" sourceColumn="ID_Customer" />
  738. <Param name="@ValidDate_PriceQueryBill" type="PriceQueryBill.ValidDate_PriceQueryBill" sourceColumn="ValidDate_PriceQueryBill" />
  739. <Param name="@ToGet_PriceQueryBill" type="PriceQueryBill.ToGet_PriceQueryBill" sourceColumn="ToGet_PriceQueryBill" />
  740. <Param name="@Name_Linkman" type="PriceQueryBill.Name_Linkman" sourceColumn="Name_Linkman" />
  741. <Param name="@Name_Telephone" type="PriceQueryBill.Name_Telephone" sourceColumn="Name_Telephone" />
  742. <Param name="@Fax_Telephone" type="PriceQueryBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
  743. <Param name="@SendAddr_PriceQueryBill" type="PriceQueryBill.SendAddr_PriceQueryBill" sourceColumn="SendAddr_PriceQueryBill" />
  744. <Param name="@TaxCurrency_PriceQueryBill" type="PriceQueryBill.TaxCurrency_PriceQueryBill" sourceColumn="TaxCurrency_PriceQueryBill" />
  745. <Param name="@Currency_PriceQueryBill" type="PriceQueryBill.Currency_PriceQueryBill" sourceColumn="Currency_PriceQueryBill" />
  746. <Param name="@ID_Principal" type="PriceQueryBill.ID_Principal" sourceColumn="ID_Principal" />
  747. <Param name="@ID_Creator" type="PriceQueryBill.ID_Creator" sourceColumn="ID_Creator" />
  748. <Param name="@CreateDate_PriceQueryBill" type="PriceQueryBill.CreateDate_PriceQueryBill" sourceColumn="CreateDate_PriceQueryBill" />
  749. <Param name="@Discount_PriceQueryBill" type="PriceQueryBill.Discount_PriceQueryBill" sourceColumn="Discount_PriceQueryBill" />
  750. <Param name="@AssessDate_PriceQueryBill" type="PriceQueryBill.AssessDate_PriceQueryBill" sourceColumn="AssessDate_PriceQueryBill" />
  751. <Param name="@ID_Assessor" type="PriceQueryBill.ID_Assessor" sourceColumn="ID_Assessor" />
  752. <Param name="@LastModUser_PriceQueryBill" type="PriceQueryBill.LastModUser_PriceQueryBill" sourceColumn="LastModUser_PriceQueryBill" />
  753. <Param name="@LastModDate_PriceQueryBill" type="PriceQueryBill.LastModDate_PriceQueryBill" sourceColumn="LastModDate_PriceQueryBill" />
  754. <Param name="@Amount_PriceQueryBill" type="PriceQueryBill.Amount_PriceQueryBill" sourceColumn="Amount_PriceQueryBill" />
  755. <Param name="@GoodsAmount_PriceQueryBill" type="PriceQueryBill.GoodsAmount_PriceQueryBill" sourceColumn="GoodsAmount_PriceQueryBill" />
  756. <Param name="@TaxAmount_PriceQueryBill" type="PriceQueryBill.TaxAmount_PriceQueryBill" sourceColumn="TaxAmount_PriceQueryBill" />
  757. <Param name="@Special_PriceQueryBill" type="PriceQueryBill.Special_PriceQueryBill" sourceColumn="Special_PriceQueryBill" />
  758. </Params>
  759. </Update>
  760. <Delete CmdType="Text" CmdText="DELETE PriceQueryBillProduct WHERE ID_PriceQueryBill=@ID_PriceQueryBill
  761. DELETE PriceQueryBill WHERE ID_PriceQueryBill=@ID_PriceQueryBill
  762. " >
  763. <Params>
  764. <Param name="@ID_PriceQueryBill" type="PriceQueryBill.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  765. </Params>
  766. </Delete>
  767. <Audit CmdType="Text" CmdText="UPDATE PriceQueryBill
  768. SET ID_Assessor=@ID_Assessor,
  769. AssessDate_PriceQueryBill=@AssessDate_PriceQueryBill
  770. WHERE ID_PriceQueryBill=@ID_PriceQueryBill
  771. Declare @ID_Product uniqueidentifier
  772. Declare @UnitPrice_PriceQueryBillProduct decimal(18,6)
  773. DECLARE @UnitPrice_PriceReference decimal(14,4)
  774. DECLARE @UnitPriceWithTax_PriceReference decimal(14,4)
  775. DECLARE @CessOut decimal(14,4)
  776. Declare cur cursor
  777. for
  778. Select ID_Product,UnitPrice_PriceQueryBillProduct
  779. From PriceQueryBillProduct
  780. Where ID_PriceQueryBill=@ID_PriceQueryBill
  781. SELECT @CessOut=CessOut_SystemSetting/100 FROM SystemSetting
  782. IF(@ID_Assessor Is Not Null)
  783. BEGIN
  784. open cur
  785. Fetch Next From cur Into @ID_Product,@UnitPrice_PriceQueryBillProduct
  786. While @@fetch_status=0
  787. BEGIN
  788. IF(@TaxCurrency_PriceQueryBill='内含')
  789. BEGIN
  790. SET @UnitPrice_PriceReference=@UnitPrice_PriceQueryBillProduct/(1+@CessOut)
  791. SET @UnitPriceWithTax_PriceReference=@UnitPrice_PriceQueryBillProduct
  792. END
  793. ELSE
  794. BEGIN
  795. SET @UnitPrice_PriceReference=@UnitPrice_PriceQueryBillProduct
  796. SET @UnitPriceWithTax_PriceReference=@UnitPrice_PriceQueryBillProduct*(1+@CessOut)
  797. END
  798. IF Exists (Select * From PriceReference Where ID_Customer=@ID_Customer AND ID_Product=@ID_Product)
  799. Update PriceReference Set UnitPrice_PriceReference=Convert(decimal(18,2),@UnitPrice_PriceReference),UnitPriceWithTax_PriceReference=Convert(decimal(18,2),@UnitPriceWithTax_PriceReference) Where ID_Customer=@ID_Customer ANd ID_Product=@ID_Product
  800. Else
  801. Insert Into PriceReference(ID_PriceReference,ID_Customer,ID_Product,UnitPrice_PriceReference,UnitPriceWithTax_PriceReference) Values(newID(),@ID_Customer,@ID_Product,Convert(decimal(18,2),@UnitPrice_PriceReference),Convert(decimal(18,2),@UnitPriceWithTax_PriceReference))
  802. Fetch Next From cur Into @ID_Product,@UnitPrice_PriceQueryBillProduct
  803. END
  804. CLOSE cur
  805. DEALLOCATE cur
  806. END
  807. ">
  808. <Params>
  809. <Param name="@ID_PriceQueryBill" type="PriceQueryBill.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  810. <Param name="@AssessDate_PriceQueryBill" type="PriceQueryBill.AssessDate_PriceQueryBill" sourceColumn="AssessDate_PriceQueryBill" />
  811. <Param name="@ID_Assessor" type="PriceQueryBill.ID_Assessor" sourceColumn="ID_Assessor" />
  812. <Param name="@ID_Customer" type="PriceQueryBill.ID_Customer" sourceColumn="ID_Customer" />
  813. <Param name="@TaxCurrency_PriceQueryBill" type="PriceQueryBill.TaxCurrency_PriceQueryBill" sourceColumn="TaxCurrency_PriceQueryBill" />
  814. </Params>
  815. </Audit>
  816. <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
  817. <UNIQUEErrorReport ErrorMessage="该报价单号已存在,提交失败!" />
  818. </Table>
  819. <Table name="PriceQueryBillProduct" Type="Child">
  820. <GetSchema CmdType="Text" CmdText="SELECT TOP 0 PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,convert(decimal(14,2),0) as AvailableQty_ProductStocks,
  821. Product.LowSalePrice_Product,Product.Price_Product As OrderPrice,CONVERT(decimal(18,6), 0) AS Amount_PriceQueryBillProduct,CONVERT(Decimal(18,6),0) AS LastPrice_PriceQueryBillProduct,CONVERT(nvarchar(64),'') as No_PriceQueryBill
  822. FROM PriceQueryBillProduct
  823. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product"/>
  824. <New CmdType="Text" CmdText="INSERT INTO PriceQueryBillProduct(
  825. ID_PriceQueryBillProduct,
  826. No_PriceQueryBillProduct,
  827. ID_PriceQueryBill,
  828. ID_Product,
  829. Quantity_PriceQueryBillProduct,
  830. OrderPrice_PriceQueryBillProduct,
  831. UnitPrice_PriceQueryBillProduct,
  832. Discount_PriceQueryBillProduct,
  833. Comment_PriceQueryBillProduct
  834. )
  835. VALUES(
  836. @ID_PriceQueryBillProduct,
  837. @No_PriceQueryBillProduct,
  838. @ID_PriceQueryBill,
  839. @ID_Product,
  840. @Quantity_PriceQueryBillProduct,
  841. @OrderPrice_PriceQueryBillProduct,
  842. @UnitPrice_PriceQueryBillProduct,
  843. @Discount_PriceQueryBillProduct,
  844. @Comment_PriceQueryBillProduct
  845. )
  846. " >
  847. <Params>
  848. <Param name="@ID_PriceQueryBillProduct" type="PriceQueryBillProduct.ID_PriceQueryBillProduct" sourceColumn="ID_PriceQueryBillProduct" />
  849. <Param name="@No_PriceQueryBillProduct" type="PriceQueryBillProduct.No_PriceQueryBillProduct" sourceColumn="No_PriceQueryBillProduct" />
  850. <Param name="@ID_PriceQueryBill" type="PriceQueryBillProduct.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  851. <Param name="@ID_Product" type="PriceQueryBillProduct.ID_Product" sourceColumn="ID_Product" />
  852. <Param name="@Quantity_PriceQueryBillProduct" type="PriceQueryBillProduct.Quantity_PriceQueryBillProduct" sourceColumn="Quantity_PriceQueryBillProduct" />
  853. <Param name="@UnitPrice_PriceQueryBillProduct" type="PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" sourceColumn="UnitPrice_PriceQueryBillProduct" />
  854. <Param name="@Discount_PriceQueryBillProduct" type="PriceQueryBillProduct.Discount_PriceQueryBillProduct" sourceColumn="Discount_PriceQueryBillProduct" />
  855. <Param name="@Comment_PriceQueryBillProduct" type="PriceQueryBillProduct.Comment_PriceQueryBillProduct" sourceColumn="Comment_PriceQueryBillProduct" />
  856. <Param name="@OrderPrice_PriceQueryBillProduct" type="PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct" sourceColumn="OrderPrice_PriceQueryBillProduct" />
  857. </Params>
  858. </New>
  859. <Update CmdType="Text" CmdText="UPDATE PriceQueryBillProduct
  860. SET No_PriceQueryBillProduct =@No_PriceQueryBillProduct ,
  861. ID_PriceQueryBill =@ID_PriceQueryBill ,
  862. ID_Product =@ID_Product ,
  863. Quantity_PriceQueryBillProduct =@Quantity_PriceQueryBillProduct ,
  864. OrderPrice_PriceQueryBillProduct=@OrderPrice_PriceQueryBillProduct,
  865. UnitPrice_PriceQueryBillProduct =@UnitPrice_PriceQueryBillProduct ,
  866. Discount_PriceQueryBillProduct =@Discount_PriceQueryBillProduct ,
  867. Comment_PriceQueryBillProduct =@Comment_PriceQueryBillProduct
  868. WHERE ID_PriceQueryBillProduct =@ID_PriceQueryBillProduct
  869. " >
  870. <Params>
  871. <Param name="@ID_PriceQueryBillProduct" type="PriceQueryBillProduct.ID_PriceQueryBillProduct" sourceColumn="ID_PriceQueryBillProduct" />
  872. <Param name="@No_PriceQueryBillProduct" type="PriceQueryBillProduct.No_PriceQueryBillProduct" sourceColumn="No_PriceQueryBillProduct" />
  873. <Param name="@ID_PriceQueryBill" type="PriceQueryBillProduct.ID_PriceQueryBill" sourceColumn="ID_PriceQueryBill" />
  874. <Param name="@ID_Product" type="PriceQueryBillProduct.ID_Product" sourceColumn="ID_Product" />
  875. <Param name="@Quantity_PriceQueryBillProduct" type="PriceQueryBillProduct.Quantity_PriceQueryBillProduct" sourceColumn="Quantity_PriceQueryBillProduct" />
  876. <Param name="@UnitPrice_PriceQueryBillProduct" type="PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" sourceColumn="UnitPrice_PriceQueryBillProduct" />
  877. <Param name="@Discount_PriceQueryBillProduct" type="PriceQueryBillProduct.Discount_PriceQueryBillProduct" sourceColumn="Discount_PriceQueryBillProduct" />
  878. <Param name="@Comment_PriceQueryBillProduct" type="PriceQueryBillProduct.Comment_PriceQueryBillProduct" sourceColumn="Comment_PriceQueryBillProduct" />
  879. <Param name="@OrderPrice_PriceQueryBillProduct" type="PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct" sourceColumn="OrderPrice_PriceQueryBillProduct" />
  880. </Params>
  881. </Update>
  882. <Delete CmdType="Text" CmdText="DELETE PriceQueryBillProduct WHERE ID_PriceQueryBillProduct = @ID_PriceQueryBillProduct" >
  883. <Params>
  884. <Param name="@ID_PriceQueryBillProduct" type="PriceQueryBillProduct.ID_PriceQueryBillProduct" sourceColumn="ID_PriceQueryBillProduct" />
  885. </Params>
  886. </Delete>
  887. </Table>
  888. <Table name="BillComment" Type="Child">
  889. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment"/>
  890. <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
  891. VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
  892. <Params>
  893. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  894. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  895. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  896. </Params>
  897. </New>
  898. <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
  899. WHERE ID_BillComment = @ID_BillComment">
  900. <Params>
  901. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  902. <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
  903. <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
  904. </Params>
  905. </Update>
  906. <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
  907. <Params>
  908. <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
  909. </Params>
  910. </Delete>
  911. </Table>
  912. <Table name="ReportComment" Type="Child">
  913. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.*, CONVERT(nvarchar(64),'') as No_PriceQueryBill FROM ReportComment"/>
  914. <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
  915. VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
  916. <Params>
  917. <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
  918. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  919. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  920. </Params>
  921. </New>
  922. <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
  923. WHERE ID_ReportComment = @ID_ReportComment">
  924. <Params>
  925. <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
  926. <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
  927. <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
  928. </Params>
  929. </Update>
  930. <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
  931. <Params>
  932. <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
  933. </Params>
  934. </Delete>
  935. </Table>
  936. </Tables>
  937. <Search>
  938. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product ,Type_Product, Price_Product, LowSalePrice_Product, SafetyQty_Product FROM Product ">
  939. <Tables>
  940. <Table name="AllProduct" />
  941. </Tables>
  942. </SearchAllProduct>
  943. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.*,Linkman.Name_Linkman,Linkman.Tel_Linkman
  944. ,No_Telephone,No_Fax,RegionalLeader.No_RegionalLeader
  945. FROM
  946. (
  947. SELECT Customer.ID_Customer,Customer.No_Customer
  948. ,Customer.ShortName_Customer,Customer.Zone_Customer
  949. ,Customer.SendAddr_Customer,RegistedAddress_Customer
  950. ,SuspendDate_Customer,Customer.Type_Customer
  951. ,Customer.Level_Customer,Customer.IsGeneric_Customer
  952. ,ID_Linkman=(Select Top 1 ID_Linkman
  953. From Linkman
  954. Where ID_Person=Customer.ID_Customer
  955. And IsMain_Linkman=1 order by name_linkman)
  956. ,ID_RegionalLeader= (Select TOP 1 ID_RegionalLeader
  957. FROM RegionalLeader
  958. WHERE ID_RegionalLeader = Customer.ID_RegionalLeader)
  959. From Customer
  960. )Customer
  961. Left Join Linkman On Customer.ID_Linkman=Linkman.ID_Linkman
  962. LEFT JOIN RegionalLeader ON RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  963. LEFT JOIN Telephone ON Telephone.ID_Person = Customer.ID_Customer and Focus_Telephone = 1
  964. left join Fax ON Fax.ID_Person = Customer.ID_Customer and Focus_Fax = 1 ">
  965. <Tables>
  966. <Table name="AllCustomer" />
  967. </Tables>
  968. </SearchAllCustomer>
  969. <SearchAllBill CmdType="Text" CmdText="SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  970. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer, Customer.ID_Creator,
  971. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill,
  972. CONVERT(decimal(18,6), 0) AS NumSum
  973. FROM PriceQueryBill
  974. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  975. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  976. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  977. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  978. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal ">
  979. <Tables>
  980. <Table name="AllBill" />
  981. </Tables>
  982. </SearchAllBill>
  983. <SearchPriceQueryBillWithNo CmdType="Text" CmdText="DECLARE @ID_PriceQueryBill uniqueidentifier
  984. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  985. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  986. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  987. Employee.No_Employee AS No_Principal,Customer.ID_Creator As CustomerCreator,Employee.Name_Employee as Principal_PriceQueryBill
  988. FROM PriceQueryBill
  989. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  990. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  991. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  992. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  993. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  994. WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill
  995. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill
  996. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  997. Product.LowSalePrice_Product,
  998. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@No_PriceQueryBill as No_PriceQueryBill
  999. FROM PriceQueryBillProduct
  1000. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  1001. WHERE PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY PriceQueryBillProduct.No_PriceQueryBillProduct
  1002. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1003. SELECT ReportComment.*, @No_PriceQueryBill as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1004. <Params>
  1005. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
  1006. </Params>
  1007. <Tables>
  1008. <Table name="PriceQueryBill" />
  1009. <Table name="PriceQueryBillProduct" />
  1010. <Table name="BillComment" />
  1011. <Table name="ReportComment" />
  1012. </Tables>
  1013. </SearchPriceQueryBillWithNo>
  1014. <SearchCustomerWithNo CmdType="Text" CmdText="
  1015. declare @LastTax_Customer1 nvarchar(64)
  1016. declare @LastTax_Customer2 nvarchar(64)
  1017. declare @LastTax_Customer3 nvarchar(64)
  1018. declare @STaxDefault1_FunctionSetting int
  1019. declare @STaxDefault2_FunctionSetting int
  1020. declare @STaxDefault3_FunctionSetting int
  1021. select @STaxDefault1_FunctionSetting = STaxDefault1_FunctionSetting,
  1022. @STaxDefault2_FunctionSetting = STaxDefault2_FunctionSetting, @STaxDefault3_FunctionSetting = STaxDefault3_FunctionSetting
  1023. from FunctionSetting
  1024. if @STaxDefault1_FunctionSetting=0
  1025. begin
  1026. select @LastTax_Customer1 = Customer.LastTax_Customer
  1027. from Customer
  1028. WHERE Customer.No_Customer = @No_Customer
  1029. end
  1030. else if @STaxDefault1_FunctionSetting = 1
  1031. begin
  1032. select top 1 @LastTax_Customer1 = TaxCurrency_PriceQueryBill
  1033. from PriceQueryBill
  1034. order by Date_PriceQueryBill desc
  1035. end
  1036. else
  1037. begin
  1038. set @LastTax_Customer1 = '外加'
  1039. end
  1040. if @STaxDefault2_FunctionSetting=0
  1041. begin
  1042. select @LastTax_Customer2 = Customer.LastTax_Customer
  1043. from Customer
  1044. WHERE Customer.No_Customer = @No_Customer
  1045. end
  1046. else if @STaxDefault2_FunctionSetting = 1
  1047. begin
  1048. select top 1 @LastTax_Customer2 = TaxCurrency_PriceQueryBill
  1049. from PriceQueryBill
  1050. order by Date_PriceQueryBill desc
  1051. end
  1052. else
  1053. begin
  1054. set @LastTax_Customer2 = '外加'
  1055. end
  1056. if @STaxDefault3_FunctionSetting=0
  1057. begin
  1058. select @LastTax_Customer3 = Customer.LastTax_Customer
  1059. from Customer
  1060. WHERE Customer.No_Customer = @No_Customer
  1061. end
  1062. else if @STaxDefault3_FunctionSetting = 1
  1063. begin
  1064. select top 1 @LastTax_Customer3 = TaxCurrency_PriceQueryBill
  1065. from PriceQueryBill
  1066. order by Date_PriceQueryBill desc
  1067. end
  1068. else
  1069. begin
  1070. set @LastTax_Customer3 = '外加'
  1071. end
  1072. if @LastTax_Customer1 is null
  1073. set @LastTax_Customer1 = isnull(@LastTax_Customer2, @LastTax_Customer3)
  1074. DECLARE @ID_Customer uniqueidentifier
  1075. SELECT Customer.ID_Customer, Customer.No_Customer, Customer.Name_Customer,Employee.Name_Employee,Employee.No_Employee, Customer.ShortName_Customer, Customer.Type_Customer, Customer.GetMethod_Customer, Customer.PostalCode_Customer, ISNULL(Customer.LastDiscount_Customer, 100) AS LastDiscount_Customer, Customer.SendAddr_Customer, ISNULL(Customer.ToGetBalance_Customer, 0) AS ToGetBalance_Customer, Customer.SuspendDate_Customer, ISNULL(@LastTax_Customer1, '外加') AS LastTax_Customer, Employee.ID_Employee As LastPrincipal_Customer,IsNull(LowDiscount_Customer,0) As LowDiscount_Customer
  1076. FROM Customer
  1077. Left Join Principal On Principal.ID_Person = Customer.ID_Customer and IsMain_Principal = 1
  1078. Left join Employee On Employee.ID_Employee = Principal.ID_Employee
  1079. WHERE Customer.No_Customer = @No_Customer
  1080. SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @No_Customer
  1081. SELECT Telephone.No_Telephone FROM Telephone WHERE Telephone.ID_Person = @ID_Customer
  1082. SELECT Fax.No_Fax FROM Fax WHERE Fax.ID_Person = @ID_Customer
  1083. SELECT Linkman.Name_Linkman FROM Linkman WHERE Linkman.ID_Person = @ID_Customer And IsMain_Linkman=1
  1084. --Drop table #Principal
  1085. " >
  1086. <Params>
  1087. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1088. </Params>
  1089. <Tables>
  1090. <Table name="Customer" />
  1091. <Table name="Telephone" />
  1092. <Table name="Fax" />
  1093. <Table name="Linkman" />
  1094. </Tables>
  1095. </SearchCustomerWithNo>
  1096. <SearchPrincipal CmdType="Text" CmdText=" SELECT Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_PriceQueryBill
  1097. FROM Principal
  1098. INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee
  1099. INNER JOIN Customer ON Customer.ID_Customer = Principal.ID_Person
  1100. WHERE Customer.No_Customer = @No_Customer">
  1101. <Params>
  1102. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1103. </Params>
  1104. <Tables>
  1105. <Table name="Principal" />
  1106. </Tables>
  1107. </SearchPrincipal>
  1108. <SearchAllPrincipal CmdType="Text" CmdText="SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_PriceQueryBill
  1109. FROM Employee order by Employee.No_Employee ">
  1110. <Tables>
  1111. <Table name="Principal" />
  1112. </Tables>
  1113. </SearchAllPrincipal>
  1114. <SearchLinkman CmdType="Text" CmdText=" SELECT Linkman.Name_Linkman
  1115. FROM Linkman
  1116. INNER JOIN Customer ON Customer.ID_Customer = Linkman.ID_Person
  1117. WHERE Customer.No_Customer = @No_Customer">
  1118. <Params>
  1119. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1120. </Params>
  1121. <Tables>
  1122. <Table name="Linkman" />
  1123. </Tables>
  1124. </SearchLinkman>
  1125. <SearchTele CmdType="Text" CmdText=" SELECT Telephone.No_Telephone
  1126. FROM Telephone
  1127. INNER JOIN Customer ON Customer.ID_Customer = Telephone.ID_Person
  1128. WHERE Customer.No_Customer = @No_Customer">
  1129. <Params>
  1130. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1131. </Params>
  1132. <Tables>
  1133. <Table name="Telephone" />
  1134. </Tables>
  1135. </SearchTele>
  1136. <SearchFax CmdType="Text" CmdText=" SELECT Fax.No_Fax
  1137. FROM Fax
  1138. INNER JOIN Customer ON Customer.ID_Customer = Fax.ID_Person
  1139. WHERE Customer.No_Customer = @No_Customer">
  1140. <Params>
  1141. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1142. </Params>
  1143. <Tables>
  1144. <Table name="Fax" />
  1145. </Tables>
  1146. </SearchFax>
  1147. <SearchCessOut CmdType="Text" CmdText=" SELECT SystemSetting.CessOut_SystemSetting FROM SystemSetting">
  1148. <Tables>
  1149. <Table name="System" />
  1150. </Tables>
  1151. </SearchCessOut>
  1152. <SearchProductWithNo CmdType="Text" CmdText=" SELECT Product.ID_Product, Name_Product, Unit_Product, Price_Product, SuspendDate_Product, LowSalePrice_Product,IsNull(A.AvailableQty_ProductStocks,0) As AvailableQty_ProductStocks
  1153. From Product
  1154. Left Join
  1155. (
  1156. Select ProductStocks.ID_Product,ProductStocks.AvailableQty_ProductStocks From ProductStocks
  1157. Left Join Location On Location.ID_Location= ProductStocks.ID_Location
  1158. Where Level_Location=0
  1159. )A
  1160. On A.ID_Product=Product.ID_Product
  1161. WHERE No_Product = @No_Product
  1162. ">
  1163. <Params>
  1164. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1165. </Params>
  1166. <Tables>
  1167. <Table name="Product" />
  1168. </Tables>
  1169. </SearchProductWithNo>
  1170. <SearchRelation CmdType="Text" CmdText=" Select UnitPrice_PriceReference,UnitPriceWithTax_PriceReference From PriceReference
  1171. Left Join Product On Product.ID_Product = PriceReference.ID_Product
  1172. Left Join Customer On Customer.ID_Customer = PriceReference.ID_Customer
  1173. Where No_Product = @No_Product And No_Customer = @No_Customer">
  1174. <Params>
  1175. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1176. <Param name="@No_Customer" type="Customer.No_Customer" Index="1" />
  1177. </Params>
  1178. <Tables>
  1179. <Table name="PriceReference" />
  1180. </Tables>
  1181. </SearchRelation>
  1182. <SearchPriceQueryBillFirst CmdType="Text" CmdText=" DECLARE @ID_PriceQueryBill uniqueidentifier
  1183. DECLARE @PriceQueryBillNo nvarchar(64)
  1184. SELECT TOP 1 @PriceQueryBillNo = PriceQueryBill.No_PriceQueryBill FROM PriceQueryBill
  1185. Join Customer On Customer.ID_Customer=PriceQueryBill.ID_Customer
  1186. Where Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1187. and Special_PriceQueryBill=case @Special when 1 then Special_PriceQueryBill else 0 End --added for Special
  1188. --and Customer.ID_RegionalLeader in
  1189. --(Select ID_RegionalLeader From Principal
  1190. --Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1191. --)
  1192. ORDER BY PriceQueryBill.No_PriceQueryBill
  1193. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  1194. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  1195. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  1196. Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill
  1197. FROM PriceQueryBill
  1198. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  1199. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  1200. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  1201. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  1202. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  1203. WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1204. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1205. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  1206. Product.LowSalePrice_Product,
  1207. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@PriceQueryBillNo as No_PriceQueryBill
  1208. FROM PriceQueryBillProduct
  1209. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  1210. WHERE PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY PriceQueryBillProduct.No_PriceQueryBillProduct
  1211. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1212. SELECT ReportComment.*,@PriceQueryBillNo as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1213. <Params>
  1214. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  1215. <Param name="@Special" type="PriceQueryBill.Special_PriceQueryBill" Index="1" />
  1216. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1217. </Params>
  1218. <Tables>
  1219. <Table name="PriceQueryBill" />
  1220. <Table name="PriceQueryBillProduct" />
  1221. <Table name="BillComment" />
  1222. <Table name="ReportComment" />
  1223. </Tables>
  1224. </SearchPriceQueryBillFirst>
  1225. <SearchPriceQueryBillPrevious CmdType="Text" CmdText=" DECLARE @ID_PriceQueryBill uniqueidentifier
  1226. DECLARE @PriceQueryBillNo nvarchar(64)
  1227. SELECT TOP 1 @PriceQueryBillNo = PriceQueryBill.No_PriceQueryBill FROM PriceQueryBill
  1228. Join Customer On Customer.ID_Customer=PriceQueryBill.ID_Customer
  1229. WHERE PriceQueryBill.No_PriceQueryBill &lt; @No_PriceQueryBill
  1230. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1231. and Special_PriceQueryBill=case @Special when 1 then Special_PriceQueryBill else 0 End --added for Special
  1232. --and Customer.ID_RegionalLeader in
  1233. --(Select ID_RegionalLeader From Principal
  1234. -- Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1235. --)
  1236. ORDER BY PriceQueryBill.No_PriceQueryBill DESC
  1237. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  1238. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  1239. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  1240. Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill
  1241. FROM PriceQueryBill
  1242. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  1243. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  1244. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  1245. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  1246. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  1247. WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1248. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1249. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  1250. Product.LowSalePrice_Product,
  1251. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@PriceQueryBillNo as No_PriceQueryBill
  1252. FROM PriceQueryBillProduct
  1253. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  1254. WHERE PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY PriceQueryBillProduct.No_PriceQueryBillProduct
  1255. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1256. SELECT ReportComment.*,@PriceQueryBillNo as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1257. <Params>
  1258. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
  1259. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1260. <Param name="@Special" type="PriceQueryBill.Special_PriceQueryBill" Index="2" />
  1261. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
  1262. </Params>
  1263. <Tables>
  1264. <Table name="PriceQueryBill" />
  1265. <Table name="PriceQueryBillProduct" />
  1266. <Table name="BillComment" />
  1267. <Table name="ReportComment" />
  1268. </Tables>
  1269. </SearchPriceQueryBillPrevious>
  1270. <SearchPriceQueryBillNext CmdType="Text" CmdText=" DECLARE @ID_PriceQueryBill uniqueidentifier
  1271. DECLARE @PriceQueryBillNo nvarchar(64)
  1272. SELECT TOP 1 @PriceQueryBillNo = PriceQueryBill.No_PriceQueryBill FROM PriceQueryBill
  1273. Join Customer On Customer.ID_Customer=PriceQueryBill.ID_Customer
  1274. WHERE PriceQueryBill.No_PriceQueryBill &gt; @No_PriceQueryBill
  1275. And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1276. and Special_PriceQueryBill=case @Special when 1 then Special_PriceQueryBill else 0 End --added for Special
  1277. --and Customer.ID_RegionalLeader in
  1278. --(Select ID_RegionalLeader From Principal
  1279. --Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1280. --)
  1281. ORDER BY PriceQueryBill.No_PriceQueryBill
  1282. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  1283. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  1284. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  1285. Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill
  1286. FROM PriceQueryBill
  1287. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  1288. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  1289. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  1290. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  1291. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  1292. WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1293. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1294. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  1295. Product.LowSalePrice_Product,
  1296. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@PriceQueryBillNo as No_PriceQueryBill
  1297. FROM PriceQueryBillProduct
  1298. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  1299. WHERE PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY PriceQueryBillProduct.No_PriceQueryBillProduct
  1300. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1301. SELECT ReportComment.*,@PriceQueryBillNo as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1302. <Params>
  1303. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
  1304. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1305. <Param name="@Special" type="PriceQueryBill.Special_PriceQueryBill" Index="2" />
  1306. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="3" />
  1307. </Params>
  1308. <Tables>
  1309. <Table name="PriceQueryBill" />
  1310. <Table name="PriceQueryBillProduct" />
  1311. <Table name="BillComment" />
  1312. <Table name="ReportComment" />
  1313. </Tables>
  1314. </SearchPriceQueryBillNext>
  1315. <SearchPriceQueryBillLast CmdType="Text" CmdText=" DECLARE @ID_PriceQueryBill uniqueidentifier
  1316. DECLARE @PriceQueryBillNo nvarchar(64)
  1317. SELECT TOP 1 @PriceQueryBillNo = PriceQueryBill.No_PriceQueryBill FROM PriceQueryBill
  1318. Join Customer On Customer.ID_Customer=PriceQueryBill.ID_Customer
  1319. Where Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1320. and Special_PriceQueryBill=case @Special when 1 then Special_PriceQueryBill else 0 End --added for Special
  1321. --and Customer.ID_RegionalLeader in
  1322. --(Select ID_RegionalLeader From Principal
  1323. --Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1324. -- )
  1325. ORDER BY PriceQueryBill.No_PriceQueryBill DESC
  1326. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  1327. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer,
  1328. a.Name_User AS Name_Creator, ISNULL(b.Name_User, '') AS Name_Assessor, ISNULL(c.Name_User, '') AS LastModUserName,
  1329. Employee.No_Employee AS No_Principal,Employee.Name_Employee as Principal_PriceQueryBill
  1330. FROM PriceQueryBill
  1331. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  1332. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  1333. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  1334. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  1335. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  1336. WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1337. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @PriceQueryBillNo
  1338. SELECT PriceQueryBillProduct.*, Product.No_Product, Product.Name_Product, Product.Unit_Product,
  1339. Product.LowSalePrice_Product,
  1340. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@PriceQueryBillNo as No_PriceQueryBill
  1341. FROM PriceQueryBillProduct
  1342. LEFT JOIN Product ON Product.ID_Product = PriceQueryBillProduct.ID_Product
  1343. WHERE PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY PriceQueryBillProduct.No_PriceQueryBillProduct
  1344. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1345. SELECT ReportComment.*,@PriceQueryBillNo as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1346. <Params>
  1347. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  1348. <Param name="@Special" type="PriceQueryBill.Special_PriceQueryBill" Index="1" />
  1349. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1350. </Params>
  1351. <Tables>
  1352. <Table name="PriceQueryBill" />
  1353. <Table name="PriceQueryBillProduct" />
  1354. <Table name="BillComment" />
  1355. <Table name="ReportComment" />
  1356. </Tables>
  1357. </SearchPriceQueryBillLast>
  1358. <SearchPQDate CmdType="Text" CmdText=" declare @PQDate_FunctionSetting int
  1359. select @PQDate_FunctionSetting=ISNULL(PQDate_FunctionSetting, 0) from FunctionSetting
  1360. select dateadd(day,@PQDate_FunctionSetting,getdate()) as ValiDate ">
  1361. <Tables>
  1362. <Table name="PQDate"/>
  1363. </Tables>
  1364. </SearchPQDate>
  1365. <SearchTypeComment CmdType="Text" CmdText="
  1366. declare @PQRemark1_FunctionSetting int
  1367. declare @PQRemark2_FunctionSetting int
  1368. Select @PQRemark1_FunctionSetting = PQRemark1_FunctionSetting, @PQRemark2_FunctionSetting = PQRemark2_FunctionSetting
  1369. from FunctionSetting
  1370. declare @ID_PriceQueryBill uniqueidentifier
  1371. declare @flag int
  1372. set @flag = 0
  1373. if @PQRemark1_FunctionSetting = 0
  1374. begin
  1375. select top 1 @ID_PriceQueryBill = PriceQueryBill.ID_PriceQueryBill
  1376. from PriceQueryBill
  1377. where ID_Customer = @ID_Customer
  1378. order by PriceQueryBill.Date_PriceQueryBill desc
  1379. if exists( select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_PriceQueryBill)
  1380. begin
  1381. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment
  1382. set @flag = 1
  1383. end
  1384. end
  1385. else
  1386. begin
  1387. if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
  1388. begin
  1389. SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
  1390. set @flag = 1
  1391. end
  1392. end
  1393. if @flag = 0
  1394. begin
  1395. if @PQRemark2_FunctionSetting = 0
  1396. begin
  1397. select top 1 @ID_PriceQueryBill = PriceQueryBill.ID_PriceQueryBill
  1398. from PriceQueryBill
  1399. where ID_Customer = @ID_Customer
  1400. order by PriceQueryBill.Date_PriceQueryBill desc
  1401. select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment
  1402. end
  1403. else
  1404. begin
  1405. SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
  1406. end
  1407. end
  1408. ">
  1409. <Params>
  1410. <Param name="@ID_Customer" type="PriceQueryBill.ID_Customer" Index="0" />
  1411. </Params>
  1412. <Tables>
  1413. <Table name="TypeComment" />
  1414. </Tables>
  1415. </SearchTypeComment>
  1416. <SearchSystemSetting CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting,PQAudit_FunctionSetting,PriceDecimal_SystemSetting From SystemSetting,FunctionSetting">
  1417. <Tables>
  1418. <Table name="SystemSetting"/>
  1419. </Tables>
  1420. </SearchSystemSetting>
  1421. <SearchAvailableQty CmdType="Text" CmdText="SELECT IsNull(A.AvailableQty_ProductStocks,0) As AvailableQty_ProductStocks
  1422. FROM Product
  1423. Left Join
  1424. (SELECT ProductStocks.ID_Product,ProductStocks.ID_Location,Sum(AvailableQty_ProductStocks) AS AvailableQty_ProductStocks from ProductStocks
  1425. LEFT JOIN Location ON Location.ID_Location = ProductStocks.ID_Location
  1426. WHERE Level_Location = 0 Group By ID_Product,ProductStocks.ID_Location) A ON A.ID_Product = Product.ID_Product
  1427. WHERE No_Product = @No_Product">
  1428. <Params>
  1429. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  1430. </Params>
  1431. <Tables>
  1432. <Table name="AvailableQty" />
  1433. </Tables>
  1434. </SearchAvailableQty>
  1435. <SearchPriceQueryBillWithNo1 CmdType="Text" CmdText="DECLARE @ID_PriceQueryBill uniqueidentifier
  1436. SELECT PriceQueryBill.*,Customer.No_Customer, Customer.Name_Customer
  1437. ,Customer.ShortName_Customer,Customer.Type_Customer,Customer.LastDiscount_Customer
  1438. ,Customer.PostalCode_Customer,a.Name_User AS Name_Creator
  1439. ,ISNULL(b.Name_User, '') AS Name_Assessor,ISNULL(c.Name_User, '') AS LastModUserName
  1440. ,Employee.No_Employee AS No_Principal,Customer.ID_Creator As CustomerCreator
  1441. ,Employee.Name_Employee as Principal_PriceQueryBill
  1442. FROM PriceQueryBill
  1443. LEFT JOIN Customer ON Customer.ID_Customer = PriceQueryBill.ID_Customer
  1444. LEFT JOIN AppUser a ON a.ID_User = PriceQueryBill.ID_Creator
  1445. LEFT JOIN AppUser b ON b.ID_User = PriceQueryBill.ID_Assessor
  1446. LEFT JOIN AppUser c ON c.ID_User = PriceQueryBill.LastModUser_PriceQueryBill
  1447. LEFT JOIN Employee ON Employee.ID_Employee = PriceQueryBill.ID_Principal
  1448. WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill
  1449. SELECT @ID_PriceQueryBill=ID_PriceQueryBill FROM PriceQueryBill WHERE PriceQueryBill.No_PriceQueryBill = @No_PriceQueryBill
  1450. Select identity(int,1,1) as No_PriceQueryBillProduct, ID_PriceQueryBillProduct
  1451. ,ID_PriceQueryBill,PriceQueryBillProduct.ID_Product,Quantity_PriceQueryBillProduct
  1452. ,OrderPrice_PriceQueryBillProduct,Discount_PriceQueryBillProduct
  1453. ,UnitPrice_PriceQueryBillProduct,Comment_PriceQueryBillProduct Into #PriceQueryBillProduct
  1454. From PriceQueryBillProduct
  1455. Where PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill
  1456. SELECT (@Count+No_PriceQueryBillProduct) as No_PriceQueryBillProduct,ID_PriceQueryBillProduct,ID_PriceQueryBill,#PriceQueryBillProduct.ID_Product,Quantity_PriceQueryBillProduct,OrderPrice_PriceQueryBillProduct,
  1457. Discount_PriceQueryBillProduct,UnitPrice_PriceQueryBillProduct,Comment_PriceQueryBillProduct,Product.No_Product, Product.Name_Product, Product.Unit_Product,
  1458. Product.LowSalePrice_Product,
  1459. (UnitPrice_PriceQueryBillProduct * Quantity_PriceQueryBillProduct) as Amount_PriceQueryBillProduct,@No_PriceQueryBill as No_PriceQueryBill
  1460. FROM #PriceQueryBillProduct
  1461. LEFT JOIN Product ON Product.ID_Product = #PriceQueryBillProduct.ID_Product
  1462. WHERE #PriceQueryBillProduct.ID_PriceQueryBill = @ID_PriceQueryBill ORDER BY #PriceQueryBillProduct.No_PriceQueryBillProduct
  1463. Drop Table #PriceQueryBillProduct
  1464. SELECT BillComment.* FROM BillComment WHERE BillComment.ID_Bill = @ID_PriceQueryBill order by BillComment.No_BillComment
  1465. SELECT ReportComment.*, @No_PriceQueryBill as No_PriceQueryBill FROM ReportComment WHERE ReportComment.ID_Bill = @ID_PriceQueryBill order by ReportComment.No_ReportComment">
  1466. <Params>
  1467. <Param name="@No_PriceQueryBill" type="PriceQueryBill.No_PriceQueryBill" Index="0" />
  1468. <Param name="@Count" type="SaleBillProduct.Type_FromBill" Index="1" />
  1469. </Params>
  1470. <Tables>
  1471. <Table name="PriceQueryBill" />
  1472. <Table name="PriceQueryBillProduct" />
  1473. <Table name="BillComment" />
  1474. <Table name="ReportComment" />
  1475. </Tables>
  1476. </SearchPriceQueryBillWithNo1>
  1477. <SearchLowSalePrice CmdType="Text" CmdText="Select * From Product Where ID_Product = @ID_Product">
  1478. <Params>
  1479. <Param name="@ID_Product" type="Product.ID_Product" Index="0" />
  1480. </Params>
  1481. <Tables>
  1482. <Table name="LowSalePrice" />
  1483. </Tables>
  1484. </SearchLowSalePrice>
  1485. <SearchCustomersIsInRegionalLeader CmdType="Text" CmdText="select * from Employee
  1486. where ID_Employee
  1487. in
  1488. (
  1489. Select ID_Employee from Principal
  1490. where ID_RegionalLeader
  1491. in
  1492. (
  1493. select ID_RegionalLeader from Customer
  1494. where No_Customer = @No_Customer
  1495. )
  1496. )
  1497. and Employee.Name_Employee = @Name_Employee
  1498. ">
  1499. <Params>
  1500. <Param name="@No_Customer" type="Customer.No_Customer" />
  1501. <Param name="@Name_Employee" type="Employee.Name_Employee" />
  1502. </Params>
  1503. <Tables>
  1504. <Table name="IsInRegionalLeader" />
  1505. </Tables>
  1506. </SearchCustomersIsInRegionalLeader>
  1507. </Search>
  1508. </Server>
  1509. <Lables>
  1510. <Search>
  1511. Empty();
  1512. NewInstance();
  1513. dtpDate.Enabled = false;
  1514. tbNo.ReadOnly = false;
  1515. tbCustomerNo.ReadOnly = true;
  1516. dtpQueryDate.Enabled = false;
  1517. ntbDiscount.ReadOnly = true;
  1518. dtpValidDate.Enabled = false;
  1519. cbTaxCurrency.Enabled = false;
  1520. cbPrincipal.Enabled = false;
  1521. cbLinkman.Enabled = false;
  1522. cbTele.Enabled = false;
  1523. cbFax.Enabled = false;
  1524. txtSendAddr.ReadOnly = true;
  1525. dgProduct.ReadOnly = true;
  1526. dgRemark.ReadOnly = true;
  1527. dgReport.ReadOnly = true;
  1528. ckSpecial.Enabled=false;
  1529. toolBar.EnableNew = GetRight(@Title,"新增");
  1530. toolBar.EnableSubmit = false;
  1531. toolBar.EnableModify = false;
  1532. toolBar.EnableDelete = false;
  1533. toolBar.EnableAudit = false;
  1534. toolBar.EnablePrint = false;
  1535. toolBar.EnableUnAudit = false;
  1536. toolBar.EnableExport = false;
  1537. toolBar.EnableImport = false;
  1538. #PriceQueryBill.ToGet_PriceQueryBill = 0;
  1539. #PriceQueryBill.Discount_PriceQueryBill = 0;
  1540. #PriceQueryBill.TaxCurrency_PriceQueryBill = "";
  1541. #PriceQueryBill.Currency_PriceQueryBill = "";
  1542. #PriceQueryBill.AssessDate_PriceQueryBill = DBNull();
  1543. #PriceQueryBill.LastModUser_PriceQueryBill = DBNull();
  1544. #PriceQueryBill.LastModDate_PriceQueryBill = DBNull();
  1545. #PriceQueryBill.NumSum = 0;
  1546. #PriceQueryBill.ValidDate_PriceQueryBill = #PQDate.ValiDate;
  1547. UpdateForm(true, "");
  1548. tbNo.Focus();
  1549. @Status = 0;
  1550. </Search>
  1551. <New>
  1552. Empty();
  1553. NewInstance();
  1554. @viewMode = false;
  1555. dtpDate.Enabled = true;
  1556. tbNo.ReadOnly = true;
  1557. tbCustomerNo.ReadOnly = false;
  1558. dtpQueryDate.Enabled = true;;
  1559. ntbDiscount.ReadOnly = false;
  1560. cbTaxCurrency.Enabled = true;
  1561. dtpValidDate.Enabled = true;
  1562. cbPrincipal.Enabled = true;
  1563. cbLinkman.Enabled = true;
  1564. cbTele.Enabled = true;
  1565. cbFax.Enabled = true;
  1566. txtSendAddr.ReadOnly = false;
  1567. dgProduct.ReadOnly = false;
  1568. dgRemark.ReadOnly = false;
  1569. dgReport.ReadOnly = false;
  1570. ckSpecial.Enabled=GetFieldRight(@Title,"最低报价","修改");
  1571. toolBar.EnableNew = false;
  1572. toolBar.EnableSubmit = GetRight(@Title,"新增");
  1573. toolBar.EnableModify = false;
  1574. toolBar.EnableDelete = false;
  1575. toolBar.EnableAudit = false;
  1576. toolBar.EnableUnAudit = false;
  1577. toolBar.EnableExport = false;
  1578. toolBar.EnableImport = true;
  1579. toolBar.EnablePrint = false;
  1580. #PriceQueryBill.ID_PriceQueryBill = NewGuid();
  1581. #PriceQueryBill.ToGet_PriceQueryBill = 0;
  1582. #PriceQueryBill.Discount_PriceQueryBill = 100;
  1583. #PriceQueryBill.TaxCurrency_PriceQueryBill = "外加";
  1584. #PriceQueryBill.Currency_PriceQueryBill = @SysCurrency;
  1585. #PriceQueryBill.ID_Creator = GetLoginUserID();
  1586. #PriceQueryBill.Name_Creator = GetCurrentUser();
  1587. #PriceQueryBill.ID_Assessor = DBNull();
  1588. #PriceQueryBill.AssessDate_PriceQueryBill = DBNull();
  1589. #PriceQueryBill.LastModUser_PriceQueryBill = DBNull();
  1590. #PriceQueryBill.LastModDate_PriceQueryBill = DBNull();
  1591. #PriceQueryBill.ID_Principal = DBNull();
  1592. #PriceQueryBill.NumSum = 0;
  1593. #PriceQueryBill.ValidDate_PriceQueryBill = #PQDate.ValiDate;
  1594. #PriceQueryBill.Date_PriceQueryBill = GetCurrentTime();
  1595. SetColumnDefaultValue("PriceQueryBillProduct", "Discount_PriceQueryBillProduct", #PriceQueryBill.Discount_PriceQueryBill);
  1596. SetColumnDefaultValue("PriceQueryBillProduct", "Quantity_PriceQueryBillProduct", 1);
  1597. UpdateForm(true, "");
  1598. dtpDate.Focus();
  1599. @Status = 1;
  1600. </New>
  1601. <View>
  1602. @viewMode = true;
  1603. dtpDate.Enabled = false;
  1604. tbNo.ReadOnly = false;
  1605. tbCustomerNo.ReadOnly = true;
  1606. ntbDiscount.ReadOnly = true;
  1607. dtpValidDate.Enabled = false;
  1608. dtpQueryDate.Enabled = false;
  1609. cbTaxCurrency.Enabled = false;
  1610. cbPrincipal.Enabled = false;
  1611. cbLinkman.Enabled = false;
  1612. cbTele.Enabled = false;
  1613. cbFax.Enabled = false;
  1614. txtSendAddr.ReadOnly = true;
  1615. dgProduct.ReadOnly = true;
  1616. dgRemark.ReadOnly = true;
  1617. dgReport.ReadOnly = true;
  1618. ckSpecial.Enabled=false;
  1619. toolBar.EnableNew = GetRight(@Title,"新增");
  1620. toolBar.EnableSubmit = false;
  1621. toolBar.EnablePrint = true;
  1622. if(Equals(#PriceQueryBill.ID_Assessor, DBNull()))
  1623. {
  1624. toolBar.EnableModify = GetRight(@Title,"修改");
  1625. toolBar.EnableDelete = GetRight(@Title,"删除");
  1626. toolBar.EnableAudit = GetRight(@Title,"审核");
  1627. toolBar.EnableUnAudit = false;
  1628. }
  1629. else
  1630. {
  1631. toolBar.EnableModify = false;
  1632. toolBar.EnableDelete = false;
  1633. toolBar.EnableAudit = false;
  1634. toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
  1635. }
  1636. toolBar.EnableExport = true;
  1637. toolBar.EnableImport = false;
  1638. UpdateForm(true, "");
  1639. @Status = 2;
  1640. tbNo.Focus();
  1641. <!--if (!Search("SearchCustomersIsInRegionalLeader",tbCustomerNo.CValue, GetCurrentUser()))
  1642. {
  1643. MessageBox("你与客户不在同一个区域,不能填单!");
  1644. tbCustomerNo.Text = "";
  1645. return;
  1646. }-->
  1647. </View>
  1648. <Modify>
  1649. @viewMode = false;
  1650. dtpDate.Enabled = false;
  1651. tbNo.ReadOnly = true;
  1652. tbCustomerNo.ReadOnly = false;
  1653. ntbDiscount.ReadOnly = false;
  1654. dtpQueryDate.Enabled = true;
  1655. dtpValidDate.Enabled = true;
  1656. cbPrincipal.Enabled = true;
  1657. cbLinkman.Enabled = true;
  1658. cbTele.Enabled = true;
  1659. cbFax.Enabled = true;
  1660. txtSendAddr.ReadOnly = false;
  1661. dgProduct.ReadOnly = false;
  1662. dgRemark.ReadOnly = false;
  1663. dgReport.ReadOnly = false;
  1664. ckSpecial.Enabled=GetFieldRight(@Title,"最低报价","修改");
  1665. toolBar.EnableNew = false;
  1666. toolBar.EnableSubmit = GetRight(@Title,"新增");
  1667. toolBar.EnableModify = false;
  1668. toolBar.EnableDelete = false;
  1669. toolBar.EnableAudit = false;
  1670. toolBar.EnableUnAudit = false;
  1671. toolBar.EnableExport = false;
  1672. toolBar.EnablePrint = false;
  1673. toolBar.EnableImport = false;
  1674. #PriceQueryBill.LastModUser_PriceQueryBill = GetLoginUserID();
  1675. #PriceQueryBill.LastModUserName = GetCurrentUser();
  1676. #PriceQueryBill.LastModDate_PriceQueryBill = DateTimeNow();
  1677. SetColumnDefaultValue("PriceQueryBillProduct", "Discount_PriceQueryBillProduct", #PriceQueryBill.Discount_PriceQueryBill);
  1678. SetColumnDefaultValue("PriceQueryBillProduct", "Quantity_PriceQueryBillProduct", 1);
  1679. @HaveAccessed = !Equals(#PriceQueryBill.AssessDate_PriceQueryBill,DBNull());
  1680. if(@HaveAccessed)
  1681. cbTaxCurrency.Enabled = false;
  1682. else
  1683. cbTaxCurrency.Enabled = true;
  1684. UpdateForm(true, "");
  1685. @Status = 3;
  1686. </Modify>
  1687. <SubmitButtonClick>
  1688. <![CDATA[
  1689. if (!Search("SearchCustomerWithNo", tbCustomerNo.CValue) || !Equals(#PriceQueryBill.ID_Customer,#Customer.ID_Customer))
  1690. {
  1691. MessageBox("请输入有效的客户编号,并按回车确认!",@Title);
  1692. tbCustomerNo.Focus();
  1693. return;
  1694. }
  1695. if (!cbTaxCurrency.CheckSelectedItem())
  1696. {
  1697. MessageBox("请选择有效的税别!",@Title);
  1698. tbDetail.SelectedIndex = 0;
  1699. cbTaxCurrency.Focus();
  1700. return;
  1701. }
  1702. if (!cbPrincipal.CheckSelectedItem())
  1703. {
  1704. MessageBox("请选择有效的负责业务!",@Title);
  1705. tbDetail.SelectedIndex = 0;
  1706. cbPrincipal.Focus();
  1707. return;
  1708. }
  1709. if (RowCount("#PriceQueryBillProduct") == 0)
  1710. {
  1711. MessageBox("请输入报价产品!",@Title);
  1712. tbDetail.SelectedIndex = 1;
  1713. dgProduct.Focus();
  1714. return;
  1715. }
  1716. UpdateForm(false, "");
  1717. SuspendLayout();
  1718. @LowDiscount=GetFieldRight(@Title,"最低报价","查看");
  1719. for (@i=0;@i<RowCount("#PriceQueryBillProduct");@i=@i+1)
  1720. {
  1721. SetPosition("#PriceQueryBillProduct", @i);
  1722. if(Equals(#PriceQueryBillProduct.No_Product,""))
  1723. {
  1724. tbDetail.SelectedIndex = 1;
  1725. dgProduct.CurrentRowIndex = @i;
  1726. MessageBox("请填入产品编号!",@Title);
  1727. dgProduct.Focus();
  1728. ResumeLayout();
  1729. return;
  1730. }
  1731. if(Equals(#PriceQueryBillProduct.ID_Product,GuidEmpty()))
  1732. {
  1733. tbDetail.SelectedIndex = 1;
  1734. dgProduct.CurrentRowIndex = @i;
  1735. MessageBox("该产品不存在!",@Title);
  1736. dgProduct.Focus();
  1737. ResumeLayout();
  1738. return;
  1739. }
  1740. if (#PriceQueryBillProduct.Quantity_PriceQueryBillProduct <= 0 || #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct < 0 || #PriceQueryBillProduct.Discount_PriceQueryBillProduct < 0)
  1741. {
  1742. tbDetail.SelectedIndex = 1;
  1743. dgProduct.CurrentRowIndex = @i;
  1744. if(#PriceQueryBillProduct.Quantity_PriceQueryBillProduct <= 0)
  1745. MessageBox("数量不得小于等于0!",@Title);
  1746. else if(#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct < 0)
  1747. MessageBox("单价不得小于0!",@Title);
  1748. else
  1749. MessageBox("折扣不得小于0!",@Title);
  1750. dgProduct.Focus();
  1751. ResumeLayout();
  1752. return;
  1753. }
  1754. if(ckSpecial.Checked == false && (#PriceQueryBillProduct.Discount_PriceQueryBillProduct<#Customer.LowDiscount_Customer))
  1755. {
  1756. tbDetail.SelectedIndex = 1;
  1757. dgProduct.CurrentRowIndex = @i;
  1758. MessageBox("产品折扣低于客户最低折扣,提交失败!",@Title);
  1759. dgProduct.Focus();
  1760. ResumeLayout();
  1761. return;
  1762. }
  1763. Search("SearchLowSalePrice",#PriceQueryBillProduct.ID_Product);
  1764. if(ckSpecial.Checked == false)
  1765. {
  1766. if(cbTaxCurrency.SelectedName=="内含")
  1767. {
  1768. if (#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct/1.17 < #LowSalePrice.LowSalePrice_Product)
  1769. {
  1770. tbDetail.SelectedIndex = 1;
  1771. dgProduct.CurrentRowIndex = @i;
  1772. MessageBox("产品单价低于最低售价,提交失败!",@Title);
  1773. dgProduct.Focus();
  1774. ResumeLayout();
  1775. return;
  1776. }
  1777. }
  1778. else
  1779. {
  1780. if (#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct < #LowSalePrice.LowSalePrice_Product)
  1781. {
  1782. tbDetail.SelectedIndex = 1;
  1783. dgProduct.CurrentRowIndex = @i;
  1784. MessageBox("产品单价低于最低售价,提交失败!",@Title);
  1785. dgProduct.Focus();
  1786. ResumeLayout();
  1787. return;
  1788. }
  1789. }
  1790. }
  1791. if (Equals(#PriceQueryBillProduct.ID_PriceQueryBillProduct,GuidEmpty()))
  1792. #PriceQueryBillProduct.ID_PriceQueryBillProduct = NewGuid();
  1793. #PriceQueryBillProduct.ID_PriceQueryBill =#PriceQueryBill.ID_PriceQueryBill;
  1794. }
  1795. for (@i=RowCount("#BillComment")-1;@i>=0;@i=@i-1)
  1796. {
  1797. SetPosition("#BillComment", @i);
  1798. if(#BillComment.Comment_BillComment=="")
  1799. {
  1800. DeleteRow( "#BillComment",@i);
  1801. continue;
  1802. }
  1803. if (Equals(#BillComment.ID_BillComment,GuidEmpty()))
  1804. #BillComment.ID_BillComment = NewGuid();
  1805. #BillComment.ID_Bill = #PriceQueryBill.ID_PriceQueryBill;
  1806. }
  1807. for (@i=0;@i<RowCount("#ReportComment");@i=@i+1)
  1808. {
  1809. SetPosition("#ReportComment", @i);
  1810. if (Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
  1811. #ReportComment.ID_ReportComment = NewGuid();
  1812. #ReportComment.ID_Bill = #PriceQueryBill.ID_PriceQueryBill;
  1813. }
  1814. ResumeLayout();
  1815. if(@Status == 1)
  1816. {
  1817. #PriceQueryBill.CreateDate_PriceQueryBill=GetCurrentTime();
  1818. #PriceQueryBill.No_PriceQueryBill = New("#PriceQueryBill.No_PriceQueryBill", dtpDate.CValue);
  1819. }
  1820. else if(@Status == 3)
  1821. {
  1822. #PriceQueryBill.LastModDate_PriceQueryBill=GetCurrentTime();
  1823. Update();
  1824. }
  1825. ChangeMode("View");
  1826. ]]>
  1827. </SubmitButtonClick>
  1828. <CountSum>
  1829. <![CDATA[
  1830. if (RowCount("#PriceQueryBillProduct") == 0)
  1831. {
  1832. #PriceQueryBill.NumSum = 0;
  1833. #PriceQueryBill.GoodsAmount_PriceQueryBill = 0;
  1834. #PriceQueryBill.TaxAmount_PriceQueryBill = 0;
  1835. #PriceQueryBill.Amount_PriceQueryBill = 0;
  1836. }
  1837. else
  1838. {
  1839. #PriceQueryBill.NumSum = SumOfCol("#PriceQueryBillProduct.Quantity_PriceQueryBillProduct");
  1840. switch (cbTaxCurrency.SelectedName)
  1841. {
  1842. case "外加":
  1843. #PriceQueryBill.GoodsAmount_PriceQueryBill = SumOfCol("#PriceQueryBillProduct.Amount_PriceQueryBillProduct");
  1844. #PriceQueryBill.TaxAmount_PriceQueryBill=0;
  1845. SuspendLayout();
  1846. for(@i=0;@i < RowCount("#PriceQueryBillProduct");@i++)
  1847. {
  1848. SetPosition("#PriceQueryBillProduct",@i);
  1849. #PriceQueryBill.TaxAmount_PriceQueryBill +=FormatNumber(#PriceQueryBillProduct.Amount_PriceQueryBillProduct * @CessOut, #SystemSetting.PriceDecimal_SystemSetting);
  1850. }
  1851. ResumeLayout();
  1852. #PriceQueryBill.Amount_PriceQueryBill = #PriceQueryBill.GoodsAmount_PriceQueryBill + #PriceQueryBill.TaxAmount_PriceQueryBill;
  1853. break;
  1854. case "内含":
  1855. #PriceQueryBill.Amount_PriceQueryBill = SumOfCol("#PriceQueryBillProduct.Amount_PriceQueryBillProduct");
  1856. #PriceQueryBill.TaxAmount_PriceQueryBill = 0;
  1857. SuspendLayout();
  1858. for(@i=0;@i < RowCount("#PriceQueryBillProduct");@i++)
  1859. {
  1860. SetPosition("#PriceQueryBillProduct",@i);
  1861. #PriceQueryBill.TaxAmount_PriceQueryBill +=FormatNumber(#PriceQueryBillProduct.Amount_PriceQueryBillProduct * @CessOut / (1 + @CessOut), #SystemSetting.PriceDecimal_SystemSetting);
  1862. }
  1863. ResumeLayout();
  1864. #PriceQueryBill.GoodsAmount_PriceQueryBill = #PriceQueryBill.Amount_PriceQueryBill - #PriceQueryBill.TaxAmount_PriceQueryBill;
  1865. break;
  1866. case "零税":
  1867. case "免税":
  1868. #PriceQueryBill.GoodsAmount_PriceQueryBill = SumOfCol("#PriceQueryBillProduct.Amount_PriceQueryBillProduct");
  1869. #PriceQueryBill.TaxAmount_PriceQueryBill = 0;
  1870. #PriceQueryBill.Amount_PriceQueryBill = #PriceQueryBill.GoodsAmount_PriceQueryBill;
  1871. break;
  1872. }
  1873. }
  1874. UpdateForm(true, "ntbNumSum");
  1875. UpdateForm(true, "ntbTaxSum");
  1876. UpdateForm(true, "ntbMoneySum");
  1877. UpdateForm(true, "ntbSum");
  1878. ]]>
  1879. </CountSum>
  1880. <CountPrice>
  1881. <![CDATA[
  1882. if (RowCount("#PriceQueryBillProduct") != 0)
  1883. {
  1884. switch (cbTaxCurrency.SelectedName)
  1885. {
  1886. case "内含":
  1887. SuspendLayout();
  1888. for(@j=0;@j<RowCount("#PriceQueryBillProduct");@j=@j+1)
  1889. {
  1890. SetPosition("#PriceQueryBillProduct", @j);
  1891. if(Search("SearchProductWithNo",#PriceQueryBillProduct.No_Product))
  1892. {
  1893. @Price=#Product.Price_Product;
  1894. #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct=FormatNumber(@Price*(1 + @CessOut),@PriceDecimal);
  1895. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*#PriceQueryBillProduct.Discount_PriceQueryBillProduct/100,@PriceDecimal);
  1896. }
  1897. }
  1898. ResumeLayout();
  1899. break;
  1900. case "外加":
  1901. case "零税":
  1902. case "免税":
  1903. SuspendLayout();
  1904. for(@j=0;@j<RowCount("#PriceQueryBillProduct");@j=@j+1)
  1905. {
  1906. SetPosition("#PriceQueryBillProduct", @j);
  1907. if(Search("SearchProductWithNo",#PriceQueryBillProduct.No_Product))
  1908. {
  1909. @Price=#Product.Price_Product;
  1910. #PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct=@Price;
  1911. #PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct = FormatNumber(#PriceQueryBillProduct.OrderPrice_PriceQueryBillProduct*#PriceQueryBillProduct.Discount_PriceQueryBillProduct/100,@PriceDecimal);
  1912. }
  1913. }
  1914. ResumeLayout();
  1915. break;
  1916. }
  1917. }
  1918. ]]>
  1919. </CountPrice>
  1920. <ChangeDiscount>
  1921. <![CDATA[
  1922. if (RowCount("#PriceQueryBillProduct") > 0)
  1923. {
  1924. SuspendLayout();
  1925. for (@a=0;@a<RowCount("#PriceQueryBillProduct");@a=@a+1)
  1926. {
  1927. SetPosition("#PriceQueryBillProduct", @a);
  1928. #PriceQueryBillProduct.Discount_PriceQueryBillProduct = #PriceQueryBill.Discount_PriceQueryBill;
  1929. }
  1930. ResumeLayout();
  1931. }
  1932. SetColumnDefaultValue("PriceQueryBillProduct", "Discount_PriceQueryBillProduct", #PriceQueryBill.Discount_PriceQueryBill);
  1933. ]]>
  1934. </ChangeDiscount>
  1935. <AuditLable>
  1936. BeginAudit();
  1937. #PriceQueryBill.ID_Assessor = GetLoginUserID();
  1938. #PriceQueryBill.Name_Assessor = GetCurrentUser();
  1939. #PriceQueryBill.AssessDate_PriceQueryBill = DateTimeNow();
  1940. Audit();
  1941. ChangeMode("View");
  1942. EndAudit();
  1943. <Lable name="CountSum" />
  1944. </AuditLable>
  1945. <AvailableQty_ProductStocks>
  1946. <![CDATA[
  1947. SuspendLayout();
  1948. for (@i=0;@i<RowCount("#PriceQueryBillProduct");@i=@i+1)
  1949. {
  1950. SetPosition("#PriceQueryBillProduct", @i);
  1951. Search("SearchAvailableQty",#PriceQueryBillProduct.No_Product);
  1952. #PriceQueryBillProduct.AvailableQty_ProductStocks = #AvailableQty.AvailableQty_ProductStocks;
  1953. UpdateForm(true, "");
  1954. }
  1955. ResumeLayout();
  1956. ]]>
  1957. </AvailableQty_ProductStocks>
  1958. </Lables>
  1959. </Form>
  1960. </Forms>