123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043 |
- <?xml version="1.0" encoding="UTF-8"?>
- <Forms>
- <Form Name="FrmPurchaseBill">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @SetFlag=1;
- @Title="采购订单";
- GetSchema();
- Search("SearchFormat");
- Search("SearchLocation");
- Search("SearchCessIn");
-
- Search("SearchProduct","p");
- Search("SearchPurchaseQueryBill","p");
- Search("SearchPurchaseQueryBillProduct","p","p");
-
- @CessIn=#SystemSetting.CessIn_SystemSetting/100;
- @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
- @AuditMode = #SystemSetting.PurAudit_FunctionSetting;
- @UnitPriceDecimal = #SystemSettingFormat.UnitPriceDecimal_SystemSetting;
- @PriceDecimal = #SystemSettingFormat.PriceDecimal_SystemSetting;
- @QuantityDecimal = #SystemSettingFormat.QuantityDecimal_SystemSetting;
- ChangeMode("Search");
- dgProduct.NoMember="No_PurchaseOrderBillProduct";
- if(@AuditMode)
- {
- toolBar.VisibleAudit = false;
- toolBar.EnableAudit = false;
- }
- Search("SearchBillType");
- ]]>
- </Load>
- <Closing>
- ;<!--TODO-->
- </Closing>
- <Closed>
- ;<!--TODO-->
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="PurchaseOrderBill.No_PurchaseOrderBill">
- <Events>
- <Enter>
- if(tbNo.ReadOnly == false)
- {
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchPurchaseOrderBillWithNo", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum"/>
- }
- else
- {
- MessageBox("该采购订单不存在!",@Title);
- }
- }
- else
- {
- MessageBox("请输入采购订单号!", @Title);
- }
- }
- </Enter>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKDataTimePicker name="timeMake" DataSource="PurchaseOrderBill.Date_PurchaseOrderBill" />
- <IKTextBox name="refNo" DataSource="PurchaseOrderBill.RefNo_PurchaseOrderBill"/>
- <IKComboBoxEx name="cbLocation" DisplaySource="PurchaseOrderBill.Name_Location" NoSource="PurchaseOrderBill.No_Location" ValueSource="PurchaseOrderBill.ID_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" ValueMember="ID_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextButton name="tbNoSupplier" DataSource="PurchaseOrderBill.No_Supplier" >
- <Events>
- <Enter>
- UpdateForm(false,"");
- if(tbNoSupplier.CValue!=StringEmpty())
- {
- if(!Search("SearchSupplier",tbNoSupplier.CValue))
- {
- MessageBox("该供应商不存在!",@Title);
- @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
- if(@temp != "")
- {
- tbNoSupplier.CValue = @temp;
- ActiveControlEvent("tbNoSupplier", "Enter");
- }
- }
- else
- {
- if (!Equals(#Supplier.SuspendDate_Supplier,DBNull()))
- {
- MessageBox("该供应商已停用!",@Title);
- }
- #PurchaseOrderBill.ID_Supplier=#Supplier.ID_Supplier;
- #PurchaseOrderBill.Name_Supplier=#Supplier.Name_Supplier;
- #PurchaseOrderBill.ShortName_Supplier=#Supplier.ShortName_Supplier;
- #PurchaseOrderBill.PostalCode_Supplier=#Supplier.PostalCode_Supplier;
- #PurchaseOrderBill.RegistedAddress_Supplier=#Supplier.RegistedAddress_Supplier;
- #PurchaseOrderBill.Name_Linkman="";
- #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill=#Supplier.LastTax_Supplier;
-
- Empty("#ReportComment");
- Search("SearchTypeComment",#PurchaseOrderBill.ID_Supplier);
- MergeTable("#TypeComment","#ReportComment");
-
- if(Search("SearchLinkman",#Supplier.ID_Supplier))
- {
- #PurchaseOrderBill.Name_Linkman=#linkman.Name_Linkman;
- }
- else
- {
- #PurchaseOrderBill.Name_Linkman="";
- }
- if(Search("SearchFocusTelephone",#Supplier.ID_Supplier))
- {
- #PurchaseOrderBill.Name_Telephone=#FocusTelephone.No_Telephone;
- }
- else
- {
- #PurchaseOrderBill.Name_Telephone="";
- }
- if(Search("SearchFocusFax",#Supplier.ID_Supplier))
- {
- #PurchaseOrderBill.Fax_Telephone=#FocusFax.No_Fax;
- }
- else
- {
- #PurchaseOrderBill.Fax_Telephone="";
- }
-
- }
- }
- else
- {
- MessageBox("请输入供应商编号!",@Title);
- #PurchaseOrderBill.ID_Supplier=GuidEmpty();
- #PurchaseOrderBill.ShortName_Supplier="";
- #PurchaseOrderBill.Name_Principal="";
- #PurchaseOrderBill.Name_Supplier="";
- #PurchaseOrderBill.Name_Linkman="";
- #PurchaseOrderBill.Name_Telephone="";
- #PurchaseOrderBill.Fax_Telephone="";
- #PurchaseOrderBill.PostalCode_Supplier="";
- #PurchaseOrderBill.RegistedAddress_Supplier="";
- tbNoSupplier.Focus();
- }
- UpdateForm(true,"");
- </Enter>
- <Click>
- <![CDATA[
- if (tbNoSupplier.ReadOnly == false)
- {
- @temp = ShowSearchBox("SupplierSearch","INFOMATION",tbNoSupplier.CValue);
- if( @temp == "" )
- return;
- tbNoSupplier.CValue = @temp;
- ActiveControlEvent("tbNoSupplier", "Enter");
- }
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKTextBox name="txtSupplierShortName" DataSource="PurchaseOrderBill.ShortName_Supplier"/>
- <IKComboBoxEx name="cbTaxCurrency" DisplaySource="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill">
- <Events>
- <SelectedIndexChanged>
- <Lable name="CountSum" />
- </SelectedIndexChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbCurrency" DisplaySource="PurchaseOrderBill.Currency_PurchaseOrderBill" DataSource="PurchaseOrderBill"/>
-
- <IKDataTimePicker name="arrivalDate" DataSource="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" />
- <IKComboBoxEx name="cbPrincipal" ValueSource="PurchaseOrderBill.ID_Principal" DisplaySource="PurchaseOrderBill.Name_Principal" NoSource="PurchaseOrderBill.No_Principal" DataSource="Principal" DisplayMember="Name_Principal" NoMember="No_Principal" ValueMember="ID_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtMaker" DataSource="PurchaseOrderBill.Creator" />
- <IKTextBox name="txtAssessor" DataSource="PurchaseOrderBill.Assessor" />
- <IKDateTimeText name="dtAssessDate" DataSource="PurchaseOrderBill.AssessDate_PurchaseOrderBill" />
- <IKTextBox name="txtLastModUser" DataSource="PurchaseOrderBill.LastModUser"/>
- <IKDateTimeText name="dtLastModDate" DataSource="PurchaseOrderBill.LastModDate_PurchaseOrderBill"/>
- <IKTextBox name="txtNameSupplier" DataSource="PurchaseOrderBill.Name_Supplier"/>
- <IKComboBoxEx name="cbLinkman" DisplaySource="PurchaseOrderBill.Name_Linkman" DataSource="Linkman" DisplayMember="Name_Linkman">
- <Events>
- <Reload>
- UpdateForm(false, "cbLinkman");
- Search("SearchLinkman",#PurchaseOrderBill.ID_Supplier);
- UpdateForm(true, "cbLinkman");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbTelephone" DisplaySource="PurchaseOrderBill.Name_Telephone" DataSource="Telephone" DisplayMember="No_Telephone">
- <Events>
- <Reload>
- UpdateForm(false, "cbTelephone");
- Search("SearchTelephone",#PurchaseOrderBill.ID_Supplier);
- UpdateForm(true, "cbTelephone");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbFax" DisplaySource="PurchaseOrderBill.Fax_Telephone" DataSource="Fax" DisplayMember="No_Fax">
- <Events>
- <Reload>
- UpdateForm(false, "cbFax");
- Search("SearchFax",#PurchaseOrderBill.ID_Supplier);
- UpdateForm(true, "cbFax");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextBox name="txtPostalcode" DataSource="PurchaseOrderBill.PostalCode_Supplier"/>
- <IKTextBox name="txtAddress" DataSource="PurchaseOrderBill.RegistedAddress_Supplier"/>
-
- <IKDataGridEx name="dgProduct" DataSource="PurchaseOrderBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct"/>
- <DataColumn Index="1" DataSource="PurchaseOrderBillProduct.Name_BillType" >
- <IKDataGridComboBoxColumn DisplaySourceEx="PurchaseOrderBillProduct.Name_BillType" ValueSourceEx="PurchaseOrderBillProduct.Type_FromBill" DataSourceEx="BillType" DisplayMemberEx="Name_BillType" ValueMemberEx="Value_BillType">
- <Events>
- <Reload>
- Search("SearchBillType");
- SetDataGridColumnDataSource(1,"dgProduct");
- </Reload>
- </Events>
- </IKDataGridComboBoxColumn>
- </DataColumn>
- <DataColumn Index="2" DataSource="PurchaseOrderBillProduct.No_FromBill" />
- <DataColumn Index="3" DataSource="PurchaseOrderBillProduct.No_FromBillProduct" />
- <DataColumn Index="4" DataSource="PurchaseOrderBillProduct.No_Product" >
- <IKDataGridTextButtonColumn>
- <Events>
- <Click>
- @SetFlag=1;
- ShowSearchBox("ProductSearch","INFOMATION",#PurchaseOrderBillProduct.No_Product);
- </Click>
- <SetFlagBeforeClick>
- @SetFlag=0;
- </SetFlagBeforeClick>
- </Events>
- </IKDataGridTextButtonColumn>
- </DataColumn>
- <DataColumn Index="5" DataSource="PurchaseOrderBillProduct.Name_Product" />
- <DataColumn Index="6" DataSource="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" />
- <DataColumn Index="7" DataSource="PurchaseOrderBillProduct.Unit_Product" />
- <DataColumn Index="8" DataSource="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" />
- <DataColumn Index="9" DataSource="PurchaseOrderBillProduct.Money" />
- <DataColumn Index="10" DataSource="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" />
- </IKDataGridEx>
- <IKDataGridEx name="dgRemark" DataSource="BillComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="BillComment.Comment_BillComment" />
- </IKDataGridEx>
- <IKDataGridEx name="dgReportComment" DataSource="ReportComment" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ReportComment.Comment_ReportComment" />
- </IKDataGridEx>
- <IKNumericTextBox name="txtSum" DataSource="PurchaseOrderBill.Amount_PurchaseOrderBill"/>
- <IKNumericTextBox name="txtMoneySum" DataSource="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill"/>
- <IKNumericTextBox name="txtTaxSum" DataSource="PurchaseOrderBill.TaxAmount_PurchaseOrderBill"/>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchPurchaseOrderBillFirst"))
- {
- ChangeMode("View");
- <Lable name="CountSum"/>
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchPurchaseOrderBillPrev", tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum"/>
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchPurchaseOrderBillNext",tbNo.CValue))
- {
- ChangeMode("View");
- <Lable name="CountSum"/>
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchPurchaseOrderBillLast"))
- {
- ChangeMode("View");
- <Lable name="CountSum"/>
- }
- </ClickLast>
- <ClickNew>
- <![CDATA[
- @NextNo = GetNextAutoNumber(true);
- if (!Equals(@NextNo, ""))
- {
- ChangeMode("New");
- #PurchaseOrderBill.No_PurchaseOrderBill= @NextNo;
- UpdateForm(true, "tbNo");
- }
- ]]>
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- if(@AuditMode)
- {
- <Lable name = "AuditLable"/>
- <Lable name="CountSum"/>
- }
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- <Lable name="CountSum"/>
- </ClickModify>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- ShowPrintBox("BillSearch",#PurchaseOrderBill.No_PurchaseOrderBill,#PurchaseOrderBill.No_PurchaseOrderBill);
- </ClickPrint>
- <ClickAudit>
- if(@AuditMode)
- return;
- <Lable name = "AuditLable"/>
- <Lable name="CountSum"/>
- </ClickAudit>
- <ClickUnAudit>
- BeginUnAudit();
- #PurchaseOrderBill.ID_Assessor=DBNull();
- #PurchaseOrderBill.Assessor=DBNull();
- #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DataTimeNow();
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- <Lable name="CountSum"/>
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- <ClickExpand>
- ;
- </ClickExpand>
- <ClickImportItem>
- <![CDATA[
- if(@Status == 1 || @Status == 3)
- {
- if(toolBar.MenuItemText=="报价单")
- {
- ShowSearchBox("ImportPriceQueryBillControl","BILLCONVERT");
- }
- else if(toolBar.MenuItemText=="销货单")
- {
- ShowSearchBox("ImportSaleBillControl","BILLCONVERT");
- }
- else if(toolBar.MenuItemText=="询价单")
- {
- ShowSearchBox("ImportPurchaseQueryBillControl","BILLCONVERT","#PurchaseOrderBillProduct.Type_FromBill",43,"#PurchaseOrderBillProduct.Name_BillType","询价单");
- }
- tbNoSupplier.Focus();
- }
- ]]>
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickImportItem>
- <ClickExportItem>
- if(toolBar.MenuItemText=="采购入库单")
- {
- if(Search("SearchContr"))
- {
- ExportBillProductStart("#PurchaseInDepotBillProduct.Type_FromBill",41,"#PurchaseInDepotBillProduct.Name_BillType","采购订单","#PurchaseInDepotBillProduct.No_FromBill",#PurchaseOrderBill.No_PurchaseOrderBill,"#PurchaseInDepotBill.No_Supplier",#PurchaseOrderBill.No_Supplier);
- ExportBillProduct("dgProduct","#PurchaseOrderBillProduct","#PurchaseInDepotBillProduct.No_FromBillProduct","#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct");
- }
- else
- {
- ExportBillProductStart("#PurchaseInDepotBill.No_Supplier",#PurchaseOrderBill.No_Supplier,"#PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct","采购订单"+#PurchaseOrderBill.No_PurchaseOrderBill);
- ExportBillProduct("dgProduct","#PurchaseOrderBillProduct","#PurchaseInDepotBillProduct.No_Product","#PurchaseOrderBillProduct.No_Product");
- }
- }
- <!--初始化目标数据-->
- <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
- </ClickExportItem>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="PurchaseOrderBillProduct">
- <Events>
- <ColumnsChanged>
- <Name_BillType>
- if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if ( Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
- {
- if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
- {
- MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
- }
- }
- if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
- #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
- #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
- #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
- #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
- <Lable name="CountSum" />
- }
-
- }
-
- </Name_BillType>
- <No_FromBill>
- if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if (Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
- {
- if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
- {
- MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
- }
- }
- if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
- #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
- #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
- #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
- #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
- <Lable name="CountSum" />
- }
- }
-
- </No_FromBill>
- <No_FromBillProduct>
- if(#PurchaseOrderBillProduct.Name_BillType!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBill!=StringEmpty()&&#PurchaseOrderBillProduct.No_FromBillProduct!=StringEmpty())
- {
- if (Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
- {
- if(!Equals(#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,cbTaxCurrency.Text))
- {
- MessageBox("请注意,来源单据税别为"+#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill+"!",@Title);
- }
- }
- if(Search("SearchPurchaseQueryBillProduct",#PurchaseOrderBillProduct.No_FromBill,#PurchaseOrderBillProduct.No_FromBillProduct))
- {
- if(!Equals(#PurchaseQueryBillProduct.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #PurchaseOrderBillProduct.ID_Product=#PurchaseQueryBillProduct.ID_Product;
- #PurchaseOrderBillProduct.No_Product=#PurchaseQueryBillProduct.No_Product;
- #PurchaseOrderBillProduct.Name_Product=#PurchaseQueryBillProduct.Name_Product;
- #PurchaseOrderBillProduct.Unit_Product=#PurchaseQueryBillProduct.Unit_Product;
- #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct;
- #PurchaseOrderBillProduct.Money=#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct;
- <Lable name="CountSum" />
- }
-
- }
-
- </No_FromBillProduct>
- <No_Product>
- if(@SetFlag==0)
- {
- return;
- }
- if(#PurchaseOrderBillProduct.No_Product==StringEmpty() || !Search("SearchProduct",#PurchaseOrderBillProduct.No_Product))
- {
- if(#PurchaseOrderBillProduct.No_Product!=StringEmpty())
- MessageBox("该产品不存在!",@Title);
- #PurchaseOrderBillProduct.ID_Product=GuidEmpty();
- #PurchaseOrderBillProduct.Name_Product="";
- #PurchaseOrderBillProduct.Unit_Product="";
- @temp = ShowSearchBox("InputSearchProduct","INFOMATION",#PurchaseOrderBillProduct.No_Product);
- if(@temp != "")
- {
- ResumeColumnEvent("#PurchaseOrderBillProduct.No_Product");
- #PurchaseOrderBillProduct.No_Product = @temp;
- ClearColumnEvent();
- }
- }else{
- if(!Equals(#Product.SuspendDate_Product,DBNull()))
- {
- MessageBox("该产品已停用!",@Title);
- }
- #PurchaseOrderBillProduct.ID_Product=#Product.ID_Product;
- #PurchaseOrderBillProduct.Name_Product=#Product.Name_Product;
- #PurchaseOrderBillProduct.Unit_Product=#Product.Unit_Product;
- }
- </No_Product>
- <Quantity_PurchaseOrderBillProduct>
- #PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct=FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal);
- #PurchaseOrderBillProduct.Money=FormatNumber(FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal)*FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal),@PriceDecimal);
- <Lable name="CountSum"/>
- </Quantity_PurchaseOrderBillProduct>
- <UnitPrice_PurchaseOrderBillProduct>
- #PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct=FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal);
- #PurchaseOrderBillProduct.Money=FormatNumber(FormatNumber(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,@QuantityDecimal)*FormatNumber(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,@UnitPriceDecimal),@PriceDecimal);
- <Lable name="CountSum"/>
- </UnitPrice_PurchaseOrderBillProduct>
- </ColumnsChanged>
- <RowDeleted>
- <Lable name="CountSum"/>
- </RowDeleted>
- </Events>
- </Table>
- </Tables>
- <LockInfomation LockID="ID_PurchaseOrderBill" LockNO="No_PurchaseOrderBill" LockSearchFunction="SearchPurchaseOrderBillWithNo" LockAudit="ID_Assessor"/>
- <LogInfomation LogNO="#PurchaseOrderBill.No_PurchaseOrderBill" RecordFormField="" RecordDataGridField="#PurchaseOrderBillProduct.No_Product,#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,#PurchaseOrderBillProduct.Money"/>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="PurchaseOrderBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchPurchaseOrderBillWithNo">
- <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="采购订单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Supplier" HeaderText="供应商简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#PurchaseOrderBill.RefNo_PurchaseOrderBill" HeaderText="参考单号" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Principal" HeaderText="业务负责" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="6" MappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" HeaderText="税别" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="7" MappingName="#PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" HeaderText="到货日期" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="8" MappingName="#PurchaseOrderBill.Name_Linkman" HeaderText="联系人" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="9" MappingName="#PurchaseOrderBill.Name_Telephone" HeaderText="电话" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="10" MappingName="#PurchaseOrderBill.Fax_Telephone" HeaderText="传真" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="SupplierSearch" DataSource="Supplier" SearchFunction="SearchAllSupplier" SearchFunctionByNo="" MappingName="供应商">
- <DataColumn Index="0" MappingName="#Supplier.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Supplier.ShortName_Supplier" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="PurchaseOrderBillProduct" ShowCheckBox="true">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="InputSearchProduct" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="ImportPriceQueryBillControl" >
- <DataGridIndex DataSource="PriceQueryBill" SearchFunction="SearchAllPriceQueryBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
- <DataColumn Index="0" MappingName="#PriceQueryBill.No_PriceQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct"/>
- <DataColumn Index="1" MappingName="#PriceQueryBill.Date_PriceQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PriceQueryBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
- <DataColumn Index="3" MappingName="#PriceQueryBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PriceQueryBill.State_PriceQueryBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PriceQueryBill.TaxCurrency_PriceQueryBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="PriceQueryBillProduct" SearchFunction="SearchAllPriceQueryBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PriceQueryBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#PriceQueryBillProduct.No_PriceQueryBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PriceQueryBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PriceQueryBillProduct.Quantity_PriceQueryBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
-
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportSaleBillControl" >
- <DataGridIndex DataSource="SaleBill" SearchFunction="SearchAllSaleBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct"/>
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleBill.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
- <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#SaleBill.State_SaleBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#SaleBill.Name_Location" HeaderText="出货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.Name_Location"/>
- <DataColumn Index="6" MappingName="#SaleBill.TaxCurrency_SaleBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
- </DataGridIndex>
- <DataGridIndex DataSource="SaleBillProduct" SearchFunction="SearchAllSaleBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#SaleBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#SaleBillProduct.No_SaleBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#SaleBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#SaleBillProduct.Quantity_SaleBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#SaleBillProduct.UnitPrice_SaleBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- <ChildForm name="ImportPurchaseQueryBillControl" >
- <DataGridIndex DataSource="PurchaseQueryBill" SearchFunction="SearchAllPurchaseQueryBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="PurchaseOrderBillProduct">
- <DataColumn Index="0" MappingName="#PurchaseQueryBill.No_PurchaseQueryBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_FromBill"/>
- <DataColumn Index="1" MappingName="#PurchaseQueryBill.Date_PurchaseQueryBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="2" MappingName="#PurchaseQueryBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Supplier"/>
- <DataColumn Index="3" MappingName="#PurchaseQueryBill.ShortName_Supplier" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="4" MappingName="#PurchaseQueryBill.State_PurchaseQueryBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="5" MappingName="#PurchaseQueryBill.TaxCurrency_PurchaseQueryBill" HeaderText="税别" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" />
- <DataColumn Index="6" MappingName="#PurchaseQueryBill.No_Principal" HeaderText="采购负责号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.No_Principal"/>
- <DataColumn Index="6" MappingName="#PurchaseQueryBill.Name_Principal" HeaderText="采购负责人" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" ReturnMappingName="#PurchaseOrderBill.Name_Principal"/>
- </DataGridIndex>
- <DataGridIndex DataSource="PurchaseQueryBillProduct" SearchFunction="SearchAllPurchaseQueryBillProduct" SearchFunctionByNo="" MappingName="">
- <DataColumn Index="0" MappingName="#PurchaseQueryBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_Product"/>
- <DataColumn Index="1" MappingName="#PurchaseQueryBillProduct.No_PurchaseQueryBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#PurchaseOrderBillProduct.No_FromBillProduct"/>
- <DataColumn Index="2" MappingName="#PurchaseQueryBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
- <DataColumn Index="3" MappingName="#PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- <DataColumn Index="4" MappingName="#PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct" HeaderText="单价" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
- </DataGridIndex>
- </ChildForm>
- </ChildForms>
- <ImportedInfo>
- Search("SearchPrincipal");
- cbPrincipal.SelectedNo = #PurchaseOrderBill.No_Principal;
- cbPrincipal.SelectedName = #PurchaseOrderBill.Name_Principal;
- @TaxCurrency=#PurchaseOrderBill.TaxCurrency_PurchaseOrderBill;
- UpdateForm(true, "tbNoSupplier");
- tbNoSupplier.Focus();
- Search("SearchLocation");
- cbLocation.Text = #PurchaseOrderBill.Name_Location;
- ActiveControlEvent("tbNoSupplier", "Enter");
- #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill=@TaxCurrency;
- UpdateForm(true, "cbTaxCurrency");
- </ImportedInfo>
- </Client>
- <Server>
- <Tables>
- <Table name="PurchaseOrderBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT Top 0 PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END, ShortName_Supplier,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman,convert(decimal(18,6),0.00) As MoneySum,convert(decimal(18,6),0.00) As TaxSum
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman"/>
- <New CmdType="Text" CmdText="
- INSERT INTO PurchaseOrderBill(ID_PurchaseOrderBill,
- No_PurchaseOrderBill,
- Date_PurchaseOrderBill,
- RefNo_PurchaseOrderBill,
- ID_Location,
- ID_Supplier,
- Name_Linkman,
- Name_Telephone,
- Fax_Telephone,
- ID_Principal,
- TaxCurrency_PurchaseOrderBill,
- Currency_PurchaseOrderBill,
- ArrivalDate_PurchaseOrderBill,
- ID_Creator,
- ID_Assessor,
- AssessDate_PurchaseOrderBill,
- CreateDate_PurchaseOrderBill,
- LastModDate_PurchaseOrderBill,
- LastModUser_PurchaseOrderBill,
- Amount_PurchaseOrderBill,
- GoodsAmount_PurchaseOrderBill,
- TaxAmount_PurchaseOrderBill)
- Values(@ID_PurchaseOrderBill,
- @No_PurchaseOrderBill,
- @Date_PurchaseOrderBill,
- @RefNo_PurchaseOrderBill,
- @ID_Location,
- @ID_Supplier,
- @Name_Linkman,
- @Name_Telephone,
- @Fax_Telephone,
- @ID_Principal,
- @TaxCurrency_PurchaseOrderBill,
- @Currency_PurchaseOrderBill,
- @ArrivalDate_PurchaseOrderBill,
- @ID_Creator,
- @ID_Assessor,
- @AssessDate_PurchaseOrderBill,
- @CreateDate_PurchaseOrderBill,
- @LastModDate_PurchaseOrderBill,
- @LastModUser_PurchaseOrderBill,
- @Amount_PurchaseOrderBill,
- @GoodsAmount_PurchaseOrderBill,
- @TaxAmount_PurchaseOrderBill)
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" sourceColumn="No_PurchaseOrderBill" />
- <Param name="@Date_PurchaseOrderBill" type="PurchaseOrderBill.Date_PurchaseOrderBill" sourceColumn="Date_PurchaseOrderBill" />
- <Param name="@RefNo_PurchaseOrderBill" type="PurchaseOrderBill.RefNo_PurchaseOrderBill" sourceColumn="RefNo_PurchaseOrderBill" />
- <Param name="@ID_Location" type="PurchaseOrderBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" sourceColumn="ID_Supplier" />
- <Param name="@Name_Linkman" type="PurchaseOrderBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Name_Telephone" type="PurchaseOrderBill.Name_Telephone" sourceColumn="Name_Telephone" />
- <Param name="@Fax_Telephone" type="PurchaseOrderBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
- <Param name="@ID_Principal" type="PurchaseOrderBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@TaxCurrency_PurchaseOrderBill" type="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" sourceColumn="TaxCurrency_PurchaseOrderBill" />
- <Param name="@Currency_PurchaseOrderBill" type="PurchaseOrderBill.Currency_PurchaseOrderBill" sourceColumn="Currency_PurchaseOrderBill" />
- <Param name="@ArrivalDate_PurchaseOrderBill" type="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" sourceColumn="ArrivalDate_PurchaseOrderBill" />
- <Param name="@ID_Creator" type="PurchaseOrderBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
- <Param name="@CreateDate_PurchaseOrderBill" type="PurchaseOrderBill.CreateDate_PurchaseOrderBill" sourceColumn="CreateDate_PurchaseOrderBill" />
- <Param name="@LastModDate_PurchaseOrderBill" type="PurchaseOrderBill.LastModDate_PurchaseOrderBill" sourceColumn="LastModDate_PurchaseOrderBill" />
- <Param name="@LastModUser_PurchaseOrderBill" type="PurchaseOrderBill.LastModUser_PurchaseOrderBill" sourceColumn="LastModUser_PurchaseOrderBill" />
- <Param name="@Amount_PurchaseOrderBill" type="PurchaseOrderBill.Amount_PurchaseOrderBill" sourceColumn="Amount_PurchaseOrderBill" />
- <Param name="@GoodsAmount_PurchaseOrderBill" type="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill" sourceColumn="GoodsAmount_PurchaseOrderBill" />
- <Param name="@TaxAmount_PurchaseOrderBill" type="PurchaseOrderBill.TaxAmount_PurchaseOrderBill" sourceColumn="TaxAmount_PurchaseOrderBill" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="
- UPDATE PurchaseOrderBill
- SET No_PurchaseOrderBill=@No_PurchaseOrderBill,
- Date_PurchaseOrderBill=@Date_PurchaseOrderBill,
- RefNo_PurchaseOrderBill=@RefNo_PurchaseOrderBill,
- ID_Location=@ID_Location,
- ID_Supplier=@ID_Supplier,
- Name_Linkman=@Name_Linkman,
- Name_Telephone=@Name_Telephone,
- Fax_Telephone=@Fax_Telephone,
- ID_Principal=@ID_Principal,
- TaxCurrency_PurchaseOrderBill=@TaxCurrency_PurchaseOrderBill,
- Currency_PurchaseOrderBill=@Currency_PurchaseOrderBill,
- ArrivalDate_PurchaseOrderBill=@ArrivalDate_PurchaseOrderBill,
- ID_Creator=@ID_Creator,
- ID_Assessor=@ID_Assessor,
- AssessDate_PurchaseOrderBill=@AssessDate_PurchaseOrderBill,
- CreateDate_PurchaseOrderBill=@CreateDate_PurchaseOrderBill,
- LastModDate_PurchaseOrderBill=@LastModDate_PurchaseOrderBill,
- LastModUser_PurchaseOrderBill=@LastModUser_PurchaseOrderBill,
- Amount_PurchaseOrderBill=@Amount_PurchaseOrderBill,
- GoodsAmount_PurchaseOrderBill=@GoodsAmount_PurchaseOrderBill,
- TaxAmount_PurchaseOrderBill=@TaxAmount_PurchaseOrderBill
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" sourceColumn="No_PurchaseOrderBill" />
- <Param name="@Date_PurchaseOrderBill" type="PurchaseOrderBill.Date_PurchaseOrderBill" sourceColumn="Date_PurchaseOrderBill" />
- <Param name="@RefNo_PurchaseOrderBill" type="PurchaseOrderBill.RefNo_PurchaseOrderBill" sourceColumn="RefNo_PurchaseOrderBill" />
- <Param name="@ID_Location" type="PurchaseOrderBill.ID_Location" sourceColumn="ID_Location" />
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" sourceColumn="ID_Supplier" />
- <Param name="@Name_Linkman" type="PurchaseOrderBill.Name_Linkman" sourceColumn="Name_Linkman" />
- <Param name="@Name_Telephone" type="PurchaseOrderBill.Name_Telephone" sourceColumn="Name_Telephone" />
- <Param name="@Fax_Telephone" type="PurchaseOrderBill.Fax_Telephone" sourceColumn="Fax_Telephone" />
- <Param name="@ID_Principal" type="PurchaseOrderBill.ID_Principal" sourceColumn="ID_Principal" />
- <Param name="@TaxCurrency_PurchaseOrderBill" type="PurchaseOrderBill.TaxCurrency_PurchaseOrderBill" sourceColumn="TaxCurrency_PurchaseOrderBill" />
- <Param name="@Currency_PurchaseOrderBill" type="PurchaseOrderBill.Currency_PurchaseOrderBill" sourceColumn="Currency_PurchaseOrderBill" />
- <Param name="@ArrivalDate_PurchaseOrderBill" type="PurchaseOrderBill.ArrivalDate_PurchaseOrderBill" sourceColumn="ArrivalDate_PurchaseOrderBill" />
- <Param name="@ID_Creator" type="PurchaseOrderBill.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
- <Param name="@CreateDate_PurchaseOrderBill" type="PurchaseOrderBill.CreateDate_PurchaseOrderBill" sourceColumn="CreateDate_PurchaseOrderBill" />
- <Param name="@LastModDate_PurchaseOrderBill" type="PurchaseOrderBill.LastModDate_PurchaseOrderBill" sourceColumn="LastModDate_PurchaseOrderBill" />
- <Param name="@LastModUser_PurchaseOrderBill" type="PurchaseOrderBill.LastModUser_PurchaseOrderBill" sourceColumn="LastModUser_PurchaseOrderBill" />
- <Param name="@Amount_PurchaseOrderBill" type="PurchaseOrderBill.Amount_PurchaseOrderBill" sourceColumn="Amount_PurchaseOrderBill" />
- <Param name="@GoodsAmount_PurchaseOrderBill" type="PurchaseOrderBill.GoodsAmount_PurchaseOrderBill" sourceColumn="GoodsAmount_PurchaseOrderBill" />
- <Param name="@TaxAmount_PurchaseOrderBill" type="PurchaseOrderBill.TaxAmount_PurchaseOrderBill" sourceColumn="TaxAmount_PurchaseOrderBill" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="
- DECLARE @StockAndInDepot bit
- SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
- IF(@AssessDate_PurchaseOrderBill IS NOT NULL)
- BEGIN
- IF(@StockAndInDepot=1)
- BEGIN
- DECLARE @Quantity_InDepot decimal(14,4)
- DECLARE @Quantity_OnShip decimal(14,4)
- DECLARE @Quantity_EndCase decimal(14,4)
- SELECT @Quantity_InDepot=sum(Quantity_InDepot),@Quantity_OnShip=sum(Quantity_OnShip),@Quantity_EndCase=sum(Quantity_EndCase)
- FROM PurchaseOrderBillProduct
- LEFT JOIN PurchaseSourceBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- IF(@Quantity_InDepot > 0)
- BEGIN
- RAISERROR('该采购订单已有产品入库,删除失败!',16,1)
- return
- END
- IF(@Quantity_OnShip > 0)
- BEGIN
- RAISERROR('该采购订单已有产品在途,删除失败!',16,1)
- return
- END
- IF(@Quantity_EndCase >0)
- BEGIN
- RAISERROR('该采购订单已有产品强制结案,删除失败!',16,1)
- return
- END
-
- DELETE FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct IN
- (SELECT ID_PurchaseOrderBillProduct FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill)
- END
- END
- DELETE FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- DELETE FROM BillComment WHERE ID_Bill = @ID_PurchaseOrderBill
- DELETE FROM ReportComment WHERE ID_Bill=@ID_PurchaseOrderBill
- IF(@StockAndInDepot=1)
- DELETE FROM PurchaseOrderBill WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- ELSE
- UPDATE PurchaseOrderBill SET Disable_PurchaseOrderBill=1 WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
- <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill" />
- </Params>
- </Delete>
- <Audit CmdType="Text" CmdText="
- DECLARE @StockAndInDepot bit
-
- DECLARE @Quantity_PurchaseOrderBillProduct decimal(14,4)
- DECLARE @ID_PurchaseSourceBillProduct uniqueidentifier
- Declare @No_PurchaseOrderBillProduct nvarchar(64)
- Declare @Total decimal(14,4)
- DECLARE @InDepot decimal(14,4)
- DECLARE @Error nvarchar(256)
-
- SELECT @StockAndInDepot=StockAndInDepot_SystemSetting FROM SystemSetting
- IF(@StockAndInDepot=1)
- BEGIN
- IF(@ID_Assessor IS NULL)
- BEGIN
- SELECT @Total=Sum(Quantity_Order),@InDepot=Sum(Quantity_InDepot+Quantity_OnShip+Quantity_EndCase) FROM PurchaseSourceBillProduct
- JOIN PurchaseOrderBillProduct ON PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct=PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- IF(@Total=@InDepot And @Total!=0)
- BEGIN
- RAISERROR('此单据产品已经全部入库,取消审核失败!',16,1)
- RETURN
- END
- END
- DECLARE cur CURSOR FOR SELECT PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,No_PurchaseOrderBillProduct
- FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- OPEN cur
- FETCH Next FROM cur INTO @Quantity_PurchaseOrderBillProduct,@ID_PurchaseSourceBillProduct,@No_PurchaseOrderBillProduct
- WHILE @@fetch_status=0
- BEGIN
- IF(@ID_Assessor IS NOT NULL)
- BEGIN
- IF(NOT EXISTS(SELECT * FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- INSERT INTO PurchaseSourceBillProduct(ID_PurchaseSourceBillProduct,Quantity_Order) Values(@ID_PurchaseSourceBillProduct,@Quantity_PurchaseOrderBillProduct)
- UPDATE PurchaseOrderBillProduct SET ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseSourceBillProduct
- END
- ELSE
- BEGIN
- IF(@Quantity_PurchaseOrderBillProduct < (SELECT (Quantity_OnShip+Quantity_InDepot+Quantity_EndCase)
- FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
- BEGIN
- SET @Error='序号为'+@No_PurchaseOrderBillProduct+'的产品采购数量小于该采购订单已发货与强制结案数量之和,审核失败!请于关联单据处查询。'
- RAISERROR(@Error,16,1)
- RETURN
- END
- UPDATE PurchaseSourceBillProduct SET Quantity_Order=@Quantity_PurchaseOrderBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- END
- END
- ELSE
- BEGIN
- UPDATE PurchaseSourceBillProduct SET Quantity_Order=0 WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
- END
- FETCH Next FROM cur INTO @Quantity_PurchaseOrderBillProduct,@ID_PurchaseSourceBillProduct,@No_PurchaseOrderBillProduct
- END
- DEALLOCATE cur
- END
- UPDATE PurchaseOrderBill SET ID_Assessor=@ID_Assessor,AssessDate_PurchaseOrderBill=@AssessDate_PurchaseOrderBill WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBill.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill"/>
- <Param name="@ID_Assessor" type="PurchaseOrderBill.ID_Assessor" sourceColumn="ID_Assessor"/>
- <Param name="@AssessDate_PurchaseOrderBill" type="PurchaseOrderBill.AssessDate_PurchaseOrderBill" sourceColumn="AssessDate_PurchaseOrderBill"/>
-
- </Params>
- </Audit>
- <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!"/>
- <UNIQUEErrorReport ErrorMessage="采购订库单编号已存在,提交失败!"/>
- </Table>
- <Table name="PurchaseOrderBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="
- SELECT Top 0 PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,Convert(nvarchar(64), '') as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- "/>
- <New CmdType="Text" CmdText="
- INSERT INTO PurchaseOrderBillProduct(ID_PurchaseOrderBillProduct,
- No_PurchaseOrderBillProduct,
- ID_PurchaseOrderBill,
- Type_FromBill,
- No_FromBill,
- No_FromBillProduct,
- ID_Product,
- Quantity_PurchaseOrderBillProduct,
- UnitPrice_PurchaseOrderBillProduct,
- Comment_PurchaseOrderBillProduct)
- Values(@ID_PurchaseOrderBillProduct,
- @No_PurchaseOrderBillProduct,
- @ID_PurchaseOrderBill,
- @Type_FromBill,
- @No_FromBill,
- @No_FromBillProduct,
- @ID_Product,
- @Quantity_PurchaseOrderBillProduct,
- @UnitPrice_PurchaseOrderBillProduct,
- @Comment_PurchaseOrderBillProduct)
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct" />
- <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" sourceColumn="No_PurchaseOrderBillProduct" />
- <Param name="@ID_PurchaseOrderBill" type="PurchaseOrderBillProduct.ID_PurchaseOrderBill" sourceColumn="ID_PurchaseOrderBill" />
- <Param name="@Type_FromBill" type="PurchaseOrderBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="PurchaseOrderBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="PurchaseOrderBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="PurchaseOrderBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" sourceColumn="Quantity_PurchaseOrderBillProduct" />
- <Param name="@UnitPrice_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" sourceColumn="UnitPrice_PurchaseOrderBillProduct" />
- <Param name="@Comment_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" sourceColumn="Comment_PurchaseOrderBillProduct" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="
- Declare @Error nvarchar(100)
- IF(@ID_PurchaseSourceBillProduct Is Not Null AND
- @Quantity_PurchaseOrderBillProduct < (SELECT (Quantity_InDepot+Quantity_OnShip+Quantity_EndCase)
- FROM PurchaseSourceBillProduct
- WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseOrderBillProduct))
- BEGIN
- SET @Error='序号为'+@No_PurchaseOrderBillProduct+'的产品采购数量小于该采购订单已发货与强制结案数量之和,提交失败!请于关联单据处查询。'
- RAISERROR(@Error,16,1)
- return
- END
-
- UPDATE PurchaseOrderBillProduct
- SET No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct,
- Type_FromBill=@Type_FromBill,
- No_FromBill=@No_FromBill,
- No_FromBillProduct=@No_FromBillProduct,
- ID_Product=@ID_Product,
- Quantity_PurchaseOrderBillProduct=@Quantity_PurchaseOrderBillProduct,
- UnitPrice_PurchaseOrderBillProduct=@UnitPrice_PurchaseOrderBillProduct,
- Comment_PurchaseOrderBillProduct=@Comment_PurchaseOrderBillProduct
- WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseOrderBillProduct
-
- ">
- <Params>
- <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct" />
- <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" sourceColumn="No_PurchaseOrderBillProduct" />
- <Param name="@Type_FromBill" type="PurchaseOrderBillProduct.Type_FromBill" sourceColumn="Type_FromBill" />
- <Param name="@No_FromBill" type="PurchaseOrderBillProduct.No_FromBill" sourceColumn="No_FromBill" />
- <Param name="@No_FromBillProduct" type="PurchaseOrderBillProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
- <Param name="@ID_Product" type="PurchaseOrderBillProduct.ID_Product" sourceColumn="ID_Product" />
- <Param name="@Quantity_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" sourceColumn="Quantity_PurchaseOrderBillProduct" />
- <Param name="@UnitPrice_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct" sourceColumn="UnitPrice_PurchaseOrderBillProduct" />
- <Param name="@Comment_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct" sourceColumn="Comment_PurchaseOrderBillProduct" />
- <Param name="@ID_PurchaseSourceBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="DELETE FROM PurchaseOrderBillProduct WHERE ID_PurchaseOrderBillProduct=@ID_PurchaseOrderBillProduct">
- <Params>
- <Param name="@ID_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct" sourceColumn="ID_PurchaseOrderBillProduct"/>
- </Params>
- </Delete>
- </Table>
- <Table name="BillComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BillComment.* FROM BillComment"/>
- <New CmdType="Text" CmdText=" INSERT INTO BillComment (ID_BillComment, ID_Bill, Comment_BillComment)
- VALUES (@ID_BillComment, @ID_Bill, @Comment_BillComment)">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE BillComment SET ID_Bill = @ID_Bill, Comment_BillComment = @Comment_BillComment
- WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- <Param name="@ID_Bill" type="BillComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_BillComment" type="BillComment.Comment_BillComment" sourceColumn="Comment_BillComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE BillComment WHERE ID_BillComment = @ID_BillComment">
- <Params>
- <Param name="@ID_BillComment" type="BillComment.ID_BillComment" sourceColumn="ID_BillComment" />
- </Params>
- </Delete>
- </Table>
- <Table name="ReportComment" Type="Child">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 ReportComment.* ,Convert(nvarchar(64), '') as No_PurchaseOrderBill FROM ReportComment"/>
- <New CmdType="Text" CmdText=" INSERT INTO ReportComment (ID_ReportComment, ID_Bill, Comment_ReportComment)
- VALUES (@ID_ReportComment, @ID_Bill, @Comment_ReportComment)">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText=" UPDATE ReportComment SET ID_Bill = @ID_Bill, Comment_ReportComment = @Comment_ReportComment
- WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_BillComment" sourceColumn="ID_ReportComment" />
- <Param name="@ID_Bill" type="ReportComment.ID_Bill" sourceColumn="ID_Bill" />
- <Param name="@Comment_ReportComment" type="ReportComment.Comment_ReportComment" sourceColumn="Comment_ReportComment" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText=" DELETE ReportComment WHERE ID_ReportComment = @ID_ReportComment">
- <Params>
- <Param name="@ID_ReportComment" type="ReportComment.ID_ReportComment" sourceColumn="ID_ReportComment" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END, ShortName_Supplier,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman,convert(decimal(18,6),'0.00') As MoneySum,convert(decimal(18,6),'0.00') As TaxSum
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE Disable_PurchaseOrderBill = 0">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <SearchAllSupplier CmdType="Text" CmdText="SELECT Supplier.No_Supplier,Supplier.ShortName_Supplier FROM Supplier ">
- <Tables>
- <Table name="AllSupplier" />
- </Tables>
- </SearchAllSupplier>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
- <Tables>
- <Table name="SystemSaleAndOutDepot" />
- </Tables>
- </SearchContr>
- <SearchPurchaseOrderBillWithNo CmdType="Text" CmdText="
- SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
-
- SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- LEFT JOIN PurchaseOrderBill ON PurchaseOrderBillProduct.ID_PurchaseOrderBill=PurchaseOrderBill.ID_PurchaseOrderBill
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
- Order By CAST(No_PurchaseOrderBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=BillComment.ID_Bill
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
- ORDER BY BillComment.No_BillComment
-
- SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM ReportComment
- LEFT JOIN PurchaseOrderBill ON PurchaseOrderBill.ID_PurchaseOrderBill=ReportComment.ID_Bill
- WHERE No_PurchaseOrderBill=@No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
- ORDER BY ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="PurchaseOrderBill"/>
- <Table name="PurchaseOrderBillProduct"/>
- <Table name="BillComment"/>
- <Table name="ReportComment"/>
- </Tables>
- </SearchPurchaseOrderBillWithNo>
- <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE SubjectionID_Location IS Null Order By No_Location">
- <Tables>
- <Table name="Location"/>
- </Tables>
- </SearchLocation>
- <SearchSupplier CmdType="Text" CmdText="
- declare @LastTax_Supplier1 nvarchar(64)
- declare @LastTax_Supplier2 nvarchar(64)
- declare @LastTax_Supplier3 nvarchar(64)
- declare @PurTaxDefault1_FunctionSetting int
- declare @PurTaxDefault2_FunctionSetting int
- declare @PurTaxDefault3_FunctionSetting int
-
- select @PurTaxDefault1_FunctionSetting = PurTaxDefault1_FunctionSetting,
- @PurTaxDefault2_FunctionSetting = PurTaxDefault2_FunctionSetting, @PurTaxDefault3_FunctionSetting = PurTaxDefault3_FunctionSetting
- from FunctionSetting
- if @PurTaxDefault1_FunctionSetting=0
- begin
- select top 1 @LastTax_Supplier1 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- Left join Supplier
- on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
- where Supplier.No_Supplier = @No_Supplier
- order by Date_PurchaseOrderBill desc
- end
- else if @PurTaxDefault1_FunctionSetting = 1
- begin
- select top 1 @LastTax_Supplier1 = TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- order by Date_PurchaseOrderBill desc
- end
- else
- begin
- set @LastTax_Supplier1 = '外加'
- end
- if @PurTaxDefault2_FunctionSetting=0
- begin
- select top 1 @LastTax_Supplier2 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- Left join Supplier
- on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
- where Supplier.No_Supplier = @No_Supplier
- order by Date_PurchaseOrderBill desc
- end
- else if @PurTaxDefault2_FunctionSetting = 1
- begin
- select top 1 @LastTax_Supplier2 = TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- order by Date_PurchaseOrderBill desc
-
- end
- else
- begin
- set @LastTax_Supplier2 = '外加'
- end
- if @PurTaxDefault3_FunctionSetting=0
- begin
- select top 1 @LastTax_Supplier3 = PurchaseOrderBill.TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- Left join Supplier
- on Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
- where Supplier.No_Supplier = @No_Supplier
- order by Date_PurchaseOrderBill desc
- end
- else if @PurTaxDefault3_FunctionSetting = 1
- begin
- select top 1 @LastTax_Supplier3 = TaxCurrency_PurchaseOrderBill
- from PurchaseOrderBill
- order by Date_PurchaseOrderBill desc
-
- end
- else
- begin
- set @LastTax_Supplier3 = '外加'
- end
- if @LastTax_Supplier1 is null
- set @LastTax_Supplier1 = isnull(@LastTax_Supplier2, @LastTax_Supplier3)
- SELECT *, ISNULL(@LastTax_Supplier1, '外加') AS LastTax_Supplier FROM Supplier
- WHERE No_Supplier=@No_Supplier
- ">
- <Params>
- <Param name="@No_Supplier" type="Supplier.No_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="Supplier"/>
- </Tables>
- </SearchSupplier>
- <SearchEmployee CmdType="Text" CmdText="
- SELECT No_Employee,Name_Employee
- FROM Employee
- ">
- <Tables>
- <Table name="Employee"/>
- </Tables>
- </SearchEmployee>
- <SearchPrincipal CmdType="Text" CmdText="SELECT Employee.ID_Employee,Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Name_Principal
- FROM Employee
- ORDER BY No_Employee
- ">
- <Tables>
- <Table name="Principal" />
- </Tables>
- </SearchPrincipal>
-
- <SearchLinkman CmdType="Text" CmdText="
- SELECT Name_Linkman,No_Employee
- FROM Linkman
- LEFT JOIN Employee ON Linkman.Name_Linkman=Employee.Name_Employee
- WHERE ID_Person=@ID_Supplier
- Order By No_Employee
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="Linkman"/>
- </Tables>
- </SearchLinkman>
- <SearchTelephone CmdType="Text" CmdText="
- SELECT No_Telephone
- FROM Telephone
- WHERE ID_Person=@ID_Supplier
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="Telephone"/>
- </Tables>
- </SearchTelephone>
- <SearchFocusTelephone CmdType="Text" CmdText="
- SELECT No_Telephone
- FROM Telephone
- WHERE ID_Person=@ID_Supplier AND Focus_Telephone=1
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="FocusTelephone"/>
- </Tables>
- </SearchFocusTelephone>
- <SearchFax CmdType="Text" CmdText="
- SELECT No_Fax
- FROM Fax
- WHERE ID_Person=@ID_Supplier
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="Fax"/>
- </Tables>
- </SearchFax>
- <SearchFocusFax CmdType="Text" CmdText="
- SELECT No_Fax
- FROM Fax
- WHERE ID_Person=@ID_Supplier AND Focus_Fax=1
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0"/>
- </Params>
- <Tables>
- <Table name="FocusFax"/>
- </Tables>
- </SearchFocusFax>
- <SearchPurchaseQueryBill CmdType="Text" CmdText="
- SELECT * FROM
- PurchaseQueryBill
- WHERE No_PurchaseQueryBill=@No_PurchaseQueryBill
- ">
- <Params>
- <Param name="@No_PurchaseQueryBill" type="PurchaseQueryBill.No_PurchaseQueryBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="PurchaseQueryBill"/>
- </Tables>
- </SearchPurchaseQueryBill>
- <SearchPurchaseQueryBillProduct CmdType="Text" CmdText="
- SELECT PurchaseQueryBillProduct.*,No_Product,Name_Product,Unit_Product,SuspendDate_Product
- FROM PurchaseQueryBillProduct
- LEFT JOIN PurchaseQueryBill ON PurchaseQueryBillProduct.ID_PurchaseQueryBill=PurchaseQueryBill.ID_PurchaseQueryBill
- LEFT JOIN Product ON PurchaseQueryBillProduct.ID_Product=Product.ID_Product
- WHERE No_PurchaseQueryBill=@No_PurchaseQueryBill and No_PurchaseQueryBillProduct=@No_PurchaseQueryBillProduct
- ">
- <Params>
- <Param name="@No_PurchaseQueryBill" type="PurchaseQueryBill.No_PurchaseQueryBill" Index="0"/>
- <Param name="@No_PurchaseQueryBillProduct" type="PurchaseQueryBillProduct.No_PurchaseQueryBillProduct" Index="1"/>
- </Params>
- <Tables>
- <Table name="PurchaseQueryBillProduct"/>
- </Tables>
- </SearchPurchaseQueryBillProduct>
- <SearchProduct CmdType="Text" CmdText="
- SELECT ID_Product, Name_Product,Unit_Product,Price_Product,SuspendDate_Product
- FROM Product
- WHERE No_Product=@No_Product
- ">
- <Params>
- <Param name="@No_Product" type="Product.No_Product" Index="0"/>
- </Params>
- <Tables>
- <Table name="Product"/>
- </Tables>
- </SearchProduct>
- <SearchBillType CmdType="Text" CmdText="
- SELECT * FROM BillType WHERE Value_BillType = 43 OR Value_BillType = 0 ORDER BY Value_BillType
- ">
- <Tables>
- <Table name="BillType"/>
- </Tables>
- </SearchBillType>
- <SearchCessIn CmdType="Text" CmdText="
- SELECT CessIn_SystemSetting,SysCurrency_SystemSetting,PurAudit_FunctionSetting FROM SystemSetting,FunctionSetting">
- <Tables>
- <Table name="SystemSetting"/>
- </Tables>
- </SearchCessIn>
- <SearchFormat CmdType="Text" CmdText="
- Select * from SystemSetting">
- <Tables>
- <Table name="SystemSettingFormat"/>
- </Tables>
- </SearchFormat>
- <SearchPurchaseOrderBillFirst CmdType="Text" CmdText=" DECLARE @No_PurchaseOrderBill nvarchar(64)
- DECLARE @ID_PurchaseOrderBill uniqueidentifier
- SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill, @No_PurchaseOrderBill = No_PurchaseOrderBill
- FROM PurchaseOrderBill
- WHERE Disable_PurchaseOrderBill=0
- Order By No_PurchaseOrderBill
-
- SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
-
- SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- Order By CAST(No_PurchaseOrderBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY BillComment.No_BillComment
-
- SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM ReportComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- ">
- <Tables>
- <Table name="PurchaseOrderBill"/>
- <Table name="PurchaseOrderBillProduct"/>
- <Table name="BillComment"/>
- <Table name="ReportComment"/>
- </Tables>
-
- </SearchPurchaseOrderBillFirst>
- <SearchPurchaseOrderBillPrev CmdType="Text" CmdText=" DECLARE @NoNext nvarchar(64)
- DECLARE @ID_PurchaseOrderBill uniqueidentifier
- SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@NoNext = No_PurchaseOrderBill
- FROM PurchaseOrderBill
- WHERE No_PurchaseOrderBill < @No_PurchaseOrderBill AND Disable_PurchaseOrderBill=0
- ORDER By No_PurchaseOrderBill Desc
-
- SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
-
- SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@NoNext as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- Order By CAST(No_PurchaseOrderBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY BillComment.No_BillComment
-
- SELECT ReportComment.*,@NoNext as No_PurchaseOrderBill
- FROM ReportComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="PurchaseOrderBill"/>
- <Table name="PurchaseOrderBillProduct"/>
- <Table name="BillComment"/>
- <Table name="ReportComment"/>
- </Tables>
- </SearchPurchaseOrderBillPrev>
- <SearchPurchaseOrderBillNext CmdType="Text" CmdText=" DECLARE @NoNext nvarchar(64)
- DECLARE @ID_PurchaseOrderBill uniqueidentifier
- SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@NoNext = No_PurchaseOrderBill
- FROM PurchaseOrderBill
- WHERE No_PurchaseOrderBill > @No_PurchaseOrderBill
- ORDER By No_PurchaseOrderBill
-
- SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
-
- SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@NoNext as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- Order By CAST(No_PurchaseOrderBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY BillComment.No_BillComment
-
- SELECT ReportComment.*,@NoNext as No_PurchaseOrderBill
- FROM ReportComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- ">
- <Params>
- <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0"/>
- </Params>
- <Tables>
- <Table name="PurchaseOrderBill"/>
- <Table name="PurchaseOrderBillProduct"/>
- <Table name="BillComment"/>
- <Table name="ReportComment"/>
- </Tables>
- </SearchPurchaseOrderBillNext>
- <SearchPurchaseOrderBillLast CmdType="Text" CmdText="DECLARE @No_PurchaseOrderBill nvarchar(64)
- DECLARE @ID_PurchaseOrderBill uniqueidentifier
- SELECT Top 1 @ID_PurchaseOrderBill=ID_PurchaseOrderBill,@No_PurchaseOrderBill = No_PurchaseOrderBill
- FROM PurchaseOrderBill
- WHERE Disable_PurchaseOrderBill=0
- Order By No_PurchaseOrderBill Desc
-
- SELECT PurchaseOrderBill.*,a.Name_User As Creator,b.Name_User As Assessor,c.Name_User As LastModUser,No_Supplier,ShortName_Supplier,Name_Supplier=CASE ISNULL(Supplier.SuspendDate_Supplier,0) WHEN 0 THEN Name_Supplier ELSE Name_Supplier+'(已暂停!)'END,RegistedAddress_Supplier,PostalCode_Supplier,Name_Location,No_Location,EmpA.Name_Employee As Name_Principal,EmpA.No_Employee As No_Principal,EmpB.No_Employee As No_Linkman
- FROM PurchaseOrderBill
- LEFT JOIN AppUser a ON a.ID_User=PurchaseOrderBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User=PurchaseOrderBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User=PurchaseOrderBill.LastModUser_PurchaseOrderBill
- LEFT JOIN Supplier ON Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- LEFT JOIN Location ON Location.ID_Location=PurchaseOrderBill.ID_Location
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseOrderBill.ID_Principal
- LEFT JOIN Employee EmpB ON EmpB.Name_Employee=PurchaseOrderBill.Name_Linkman
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
-
- SELECT PurchaseOrderBillProduct.*,Product.No_Product,Name_Product,Product.Unit_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct*PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct As Money,BillType.Name_BillType,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM PurchaseOrderBillProduct
- LEFT JOIN Product ON PurchaseOrderBillProduct.ID_Product=Product.ID_Product
- LEFT JOIN BillType ON BillType.Value_BillType=PurchaseOrderBillProduct.Type_FromBill
- WHERE ID_PurchaseOrderBill=@ID_PurchaseOrderBill
- Order By CAST(No_PurchaseOrderBillProduct AS INT)
-
- SELECT BillComment.*
- FROM BillComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY BillComment.No_BillComment
-
- SELECT ReportComment.*,@No_PurchaseOrderBill as No_PurchaseOrderBill
- FROM ReportComment
- WHERE ID_Bill=@ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- ">
- <Tables>
- <Table name="PurchaseOrderBill"/>
- <Table name="PurchaseOrderBillProduct"/>
- <Table name="BillComment"/>
- <Table name="ReportComment"/>
- </Tables>
-
- </SearchPurchaseOrderBillLast>
- <SearchAllPriceQueryBill CmdType="Text" CmdText="Select PriceQueryBill.TaxCurrency_PriceQueryBill,PriceQueryBill.ID_PriceQueryBill,PriceQueryBill.No_PriceQueryBill,PriceQueryBill.Date_PriceQueryBill,Customer.No_Customer,Customer.ShortName_Customer,Case When PriceQueryBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PriceQueryBill From PriceQueryBill
- Inner Join Customer On PriceQueryBill.ID_Customer = Customer.ID_Customer" >
- <Tables>
- <Table name="AllPriceQueryBill" />
- </Tables>
- </SearchAllPriceQueryBill>
- <SearchAllSaleBill CmdType="Text" CmdText="Select SaleBill.TaxCurrency_SaleBill, SaleBill.ID_SaleBill,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,Customer.No_Customer,Customer.ShortName_Customer,Case When SaleBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_SaleBill,Location.Name_Location From SaleBill
- Inner Join Customer On SaleBill.ID_Customer = Customer.ID_Customer
- Inner Join Location On Location.ID_Location = SaleBill.ID_Location" >
- <Tables>
- <Table name="AllSaleBill" />
- </Tables>
- </SearchAllSaleBill>
- <SearchAllPurchaseQueryBill CmdType="Text" CmdText="Select EmpA.No_Employee As No_Principal,EmpA.Name_Employee As Name_Principal,PurchaseQueryBill.TaxCurrency_PurchaseQueryBill,PurchaseQueryBill.ID_PurchaseQueryBill,PurchaseQueryBill.No_PurchaseQueryBill,PurchaseQueryBill.Date_PurchaseQueryBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseQueryBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseQueryBill From PurchaseQueryBill
- Inner Join Supplier On PurchaseQueryBill.ID_Supplier = Supplier.ID_Supplier
- LEFT JOIN Employee EmpA ON EmpA.ID_Employee=PurchaseQueryBill.ID_Principal" >
- <Tables>
- <Table name="AllPurchaseQueryBill" />
- </Tables>
- </SearchAllPurchaseQueryBill>
- <SearchAllPriceQueryBillProduct CmdType="Text" CmdText="Select Product.No_Product,PriceQueryBillProduct.No_PriceQueryBillProduct,Product.Name_Product,PriceQueryBillProduct.Quantity_PriceQueryBillProduct,PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct From PriceQueryBillProduct
- Inner Join Product On Product.ID_Product = PriceQueryBillProduct.ID_Product
- Inner Join PriceQueryBill On PriceQueryBill.ID_PriceQueryBill = PriceQueryBillProduct.ID_PriceQueryBill" >
- <Tables>
- <Table name="AllPriceQueryBillProduct" />
- </Tables>
- </SearchAllPriceQueryBillProduct>
- <SearchAllSaleBillProduct CmdType="Text" CmdText="Select Product.No_Product,SaleBillProduct.No_SaleBillProduct,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,SaleBillProduct.UnitPrice_SaleBillProduct From SaleBillProduct
- Inner Join Product On Product.ID_Product = SaleBillProduct.ID_Product
- Inner Join SaleBill On SaleBill.ID_SaleBill =SaleBillProduct.ID_SaleBill" >
- <Tables>
- <Table name="AllSaleBillProduct" />
- </Tables>
- </SearchAllSaleBillProduct>
- <SearchAllPurchaseQueryBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseQueryBillProduct.No_PurchaseQueryBillProduct,Product.Name_Product,PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct,PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct From PurchaseQueryBillProduct
- Inner Join Product On Product.ID_Product = PurchaseQueryBillProduct.ID_Product
- Inner Join PurchaseQueryBill On PurchaseQueryBill.ID_PurchaseQueryBill =PurchaseQueryBillProduct.ID_PurchaseQueryBill" >
- <Tables>
- <Table name="AllPurchaseQueryBillProduct" />
- </Tables>
- </SearchAllPurchaseQueryBillProduct>
- <SearchTypeComment CmdType="Text" CmdText="
- declare @PurRemark1_FunctionSetting int
- declare @PurRemark2_FunctionSetting int
- Select @PurRemark1_FunctionSetting = PurRemark1_FunctionSetting, @PurRemark2_FunctionSetting = PurRemark2_FunctionSetting
- from FunctionSetting
- declare @ID_PurchaseOrderBill uniqueidentifier
- declare @flag int
- set @flag = 0
-
- if @PurRemark1_FunctionSetting = 0
- begin
- select top 1 @ID_PurchaseOrderBill = PurchaseOrderBill.ID_PurchaseOrderBill
- from PurchaseOrderBill
- where ID_Supplier = @ID_Supplier
- order by PurchaseOrderBill.Date_PurchaseOrderBill desc
- if exists(select ReportComment.* from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill)
- begin
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- set @flag = 1
- end
- end
- else
- begin
- if exists(SELECT Name_TypeDef FROM TypeDef WHERE Type_TypeDef=26 )
- begin
- SELECT Name_TypeDef as Comment_ReportComment FROM TypeDef WHERE Type_TypeDef=26
- set @flag = 1
- end
- end
- if @flag = 0
- begin
- if @PurRemark2_FunctionSetting = 0
- begin
- select top 1 @ID_PurchaseOrderBill = PurchaseOrderBill.ID_PurchaseOrderBill
- from PurchaseOrderBill
- where ID_Supplier = @ID_Supplier
- order by PurchaseOrderBill.Date_PurchaseOrderBill desc
- select ReportComment.Comment_ReportComment from ReportComment where ReportComment.ID_Bill = @ID_PurchaseOrderBill
- ORDER BY ReportComment.No_ReportComment
- end
- else
- begin
- SELECT Name_TypeDef as Comment_BillComment FROM TypeDef WHERE Type_TypeDef=26
- end
- end
-
- ">
- <Params>
- <Param name="@ID_Supplier" type="PurchaseOrderBill.ID_Supplier" Index="0" />
- </Params>
- <Tables>
- <Table name="TypeComment" />
- </Tables>
- </SearchTypeComment>
- <SearchStockSettle CmdType="Text" CmdText="
- Select * From StockSettleAccounts
- Where DateDiff(Day,@Date_SaleOutDepotBill,FromDate_StockSettleAccounts) <=0
- And DateDiff(Day,@Date_SaleOutDepotBill,EndDate_StockSettleAccounts) >=0
- And Status_StockSettleAccounts=0
- ">
- <Params>
- <Param name="@Date_SaleOutDepotBill" type="PurchaseInDepotBill.Date_SaleOutDepotBill" Index="0" />
- </Params>
- <Tables>
- <Table name="StockSettle" />
- </Tables>
- </SearchStockSettle>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly=false;
- timeMake.Enabled=false;
- refNo.ReadOnly=true;
- cbLocation.Enabled=false;
- tbNoSupplier.ReadOnly=true;
- cbTaxCurrency.Enabled=false;
- cbCurrency.Enabled=false;
- arrivalDate.Enabled=false;
- cbPrincipal.Enabled=false;
- cbLinkman.Enabled=false;
- cbTelephone.Enabled=false;
- cbFax.Enabled=false;
- dgProduct.ReadOnly=true;
- dgRemark.ReadOnly=true;
- dgReportComment.ReadOnly=true;
- txtNumSum.CValue=0.00;
- txtMoneySum.CValue=0.00;
- txtTaxSum.CValue=0.00;
- txtSum.CValue=0.00;
- cbTaxCurrency.Text="";
- #PurchaseOrderBill.Creator=DBNull();
- #PurchaseOrderBill.ID_Creator=DBNull();
- #PurchaseOrderBill.Assessor=DBNull();
- #PurchaseOrderBill.ID_Assessor=DBNull();
- #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DBNull();
- #PurchaseOrderBill.LastModUser_PurchaseOrderBill=DBNull();
- #PurchaseOrderBill.LastModUser=DBNull();
- #PurchaseOrderBill.LastModDate_PurchaseOrderBill=DBNull();
- toolBar.EnableSubmit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnablePrint=false;
- toolBar.EnableNew=GetRight(@Title,"新增");
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- UpdateForm(true,"");
- tbNo.Focus();
- @Status=0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly=true;
- timeMake.Enabled=true;
- refNo.ReadOnly=false;
- cbLocation.Enabled=true;
- tbNoSupplier.ReadOnly=false;
- cbTaxCurrency.Enabled=true;
- cbCurrency.Enabled=false;
- arrivalDate.Enabled=true;
- cbPrincipal.Enabled=true;
- cbLinkman.Enabled=true;
- cbTelephone.Enabled=true;
- cbFax.Enabled=true;
- dgProduct.ReadOnly=false;
- dgRemark.ReadOnly=false;
- dgReportComment.ReadOnly=false;
- txtNumSum.CValue=0.00;
- txtMoneySum.CValue=0.00;
- txtTaxSum.CValue=0.00;
- txtSum.CValue=0.00;
- timeMake.Focus();
- #PurchaseOrderBill.TaxCurrency_PurchaseOrderBill= "外加";
- #PurchaseOrderBill.Currency_PurchaseOrderBill= @SysCurrency;
- #PurchaseOrderBill.ID_PurchaseOrderBill=NewGuid();
- #PurchaseOrderBill.Creator=GetCurrentUser();
- #PurchaseOrderBill.ID_Creator=GetLoginUserID();
- #PurchaseOrderBill.Assessor=DBNull();
- #PurchaseOrderBill.ID_Assessor=DBNull();
- #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DBNull();
- #PurchaseOrderBill.LastModUser=DBNull();
- #PurchaseOrderBill.LastModUser_PurchaseOrderBill=DBNull();
- #PurchaseOrderBill.LastModDate_PurchaseOrderBill=DBNull();
- #PurchaseOrderBill.ID_Location=GetCurrentDepotID();
- #PurchaseOrderBill.Name_Location=GetCurrentDepot();
- #PurchaseOrderBill.No_Location=GetCurrentDepotNo();
- #PurchaseOrderBill.Date_PurchaseOrderBill=GetCurrentTime();
- toolBar.EnableSubmit=GetRight(@Title,"新增");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = true;
- dgProduct.SetColumnReadOnly(1, false);
- dgProduct.SetColumnReadOnly(2, false);
- dgProduct.SetColumnReadOnly(3, false);
- dgProduct.SetColumnReadOnly(4, false);
- dgProduct.RowHeaderCheck=true;
- dgProduct.AllowNew(true);
- dgProduct.AllowDelete(true);
- SetColumnDefaultValue("PurchaseOrderBillProduct", "Quantity_PurchaseOrderBillProduct",1 );
- UpdateForm(true,"");
- @Status=1;
- </New>
- <View>
- tbNo.ReadOnly=false;
- timeMake.Enabled=false;
- refNo.ReadOnly=true;
- cbLocation.Enabled=false;
- tbNoSupplier.ReadOnly=true;
- cbTaxCurrency.Enabled=false;
- cbCurrency.Enabled=false;
- arrivalDate.Enabled=false;
- cbPrincipal.Enabled=false;
- cbLinkman.Enabled=false;
- cbTelephone.Enabled=false;
- cbFax.Enabled=false;
- dgProduct.ReadOnly=true;
- dgRemark.ReadOnly=true;
- dgReportComment.ReadOnly=true;
- toolBar.EnableSubmit=false;
- toolBar.EnablePrint=GetRight(@Title,"打印");
- toolBar.EnableNew=GetRight(@Title,"新增");
- if(Search("SearchStockSettle",#PurchaseOrderBill.Date_PurchaseOrderBill))
- {
- if(Equals(#PurchaseOrderBill.ID_Assessor, DBNull()))
- {
- toolBar.EnableAudit=GetRight(@Title,"审核");
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=GetRight(@Title,"修改");
- toolBar.EnableDelete=GetRight(@Title,"删除");
- }
- else
- {
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- }
- }
- else
- {
- toolBar.EnablePrint=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- }
- toolBar.EnableExport = true;
- toolBar.EnableImport = false;
- tbNo.Focus();
- UpdateForm(true, "");
- @Status=2;
- </View>
- <Modify>
- tbNo.ReadOnly=true;
- timeMake.Enabled=false;
- refNo.ReadOnly=false;
- cbLocation.Enabled=true;
- tbNoSupplier.ReadOnly=false;
-
- cbCurrency.Enabled=false;
- arrivalDate.Enabled=true;
- cbPrincipal.Enabled=true;
- cbLinkman.Enabled=true;
- cbTelephone.Enabled=true;
- cbFax.Enabled=true;
- dgProduct.ReadOnly=false;
- dgRemark.ReadOnly=false;
- dgReportComment.ReadOnly=false;
- #PurchaseOrderBill.LastModUser=GetCurrentUser();
- #PurchaseOrderBill.LastModUser_PurchaseOrderBill=GetLoginUserID();
- #PurchaseOrderBill.LastModDate_PurchaseOrderBill=GetCurrentTime();
- toolBar.EnableSubmit=GetRight(@Title,"修改");
- toolBar.EnableModify=false;
- toolBar.EnableDelete=false;
- toolBar.EnableAudit=false;
- toolBar.EnableUnAudit=false;
- toolBar.EnableNew=false;
- toolBar.EnablePrint=false;
- toolBar.EnableExport = false;
- toolBar.EnableImport = false;
- @HaveAccessed = !Equals(#PurchaseOrderBill.AssessDate_PurchaseOrderBill,DBNull());
- dgProduct.SetColumnReadOnly(1, @HaveAccessed);
- dgProduct.SetColumnReadOnly(2, @HaveAccessed);
- dgProduct.SetColumnReadOnly(3, @HaveAccessed);
- dgProduct.SetColumnReadOnly(4, @HaveAccessed);
- dgProduct.AllowNew(!@HaveAccessed);
- dgProduct.AllowDelete(!@HaveAccessed);
- dgProduct.RowHeaderCheck=!@HaveAccessed;
- SetColumnDefaultValue("PurchaseOrderBillProduct", "Quantity_PurchaseOrderBillProduct",1 );
- @HaveAccessed = !Equals(#PurchaseOrderBill.AssessDate_PurchaseOrderBill,DBNull());
- if(@HaveAccessed)
- cbTaxCurrency.Enabled = false;
- else
- cbTaxCurrency.Enabled = true;
- UpdateForm(true, "");
- @Status=3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if(!Search("SearchStockSettle",timeMake.Value))
- {
- MessageBox("制单日期不在开帐区间内,提交失败!");
- return;
- }
- if(!Search("SearchSupplier",tbNoSupplier.CValue)|| !Equals(#PurchaseOrderBill.ID_Supplier,#Supplier.ID_Supplier))
- {
- MessageBox("请输入有效的供应商,回车以示确认!",@Title);
- tbDetail.SelectedIndex = 0;
- tbNoSupplier.Focus();
- return;
- }
- if (!cbLocation.CheckSelectedItem())
- {
- MessageBox("请选择有效的入库仓库!",@Title);
- tbDetail.SelectedIndex = 0;
- cbLocation.Focus();
- return;
- }
- if (!cbTaxCurrency.CheckSelectedItem())
- {
- MessageBox("请选择有效的税别!",@Title);
- tbDetail.SelectedIndex = 0;
- cbTaxCurrency.Focus();
- return;
- }
- if (!cbPrincipal.CheckSelectedItem())
- {
- MessageBox("请选择有效的负责业务!",@Title);
- tbDetail.SelectedIndex = 0;
- cbPrincipal.Focus();
- return;
- }
- if(RowCount("#PurchaseOrderBillProduct")==0)
- {
- MessageBox("请输入采购产品!",@Title);
- tbDetail.SelectedIndex = 1;
- dgProduct.Focus();
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for(@i=0;@i<RowCount("#PurchaseOrderBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseOrderBillProduct",@i);
-
- if (#PurchaseOrderBillProduct.Type_FromBill != 0 &&#PurchaseOrderBillProduct.No_FromBill!=StringEmpty() && Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
- {
- if (Equals(#PurchaseQueryBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- @ClickResult = MessageBox("该来源单据未经审核,确定要保留来源单据资料吗?",@Title,MB_YESNOCANCEL);
- if (@ClickResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- else if (@ClickResult == DialogResult("NO"))
- {
- #PurchaseOrderBillProduct.Name_BillType = "";
- #PurchaseOrderBillProduct.Type_FromBill = 0;
- #PurchaseOrderBillProduct.No_FromBill = "";
- #PurchaseOrderBillProduct.No_FromBillProduct = "";
- }
- }
-
- }
- if(Equals(#PurchaseOrderBillProduct.No_Product,""))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("请输入产品编号!",@Title);
- ResumeLayout();
- return;
- }
- if(Equals(#PurchaseOrderBillProduct.ID_Product,GuidEmpty()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("该产品不存在!",@Title);
- ResumeLayout();
- return;
- }
- if(#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct<=0)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("数量不得小于等于0!",@Title);
- ResumeLayout();
- return;
- }
- if(#PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct<0)
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex=@i;
- MessageBox("单价不得小于0!",@Title);
- ResumeLayout();
- return;
- }
-
- if(Equals(#PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct,GuidEmpty()))
- {
- #PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct=NewGuid();
- }
- #PurchaseOrderBillProduct.ID_PurchaseOrderBill=#PurchaseOrderBill.ID_PurchaseOrderBill;
- }
- for(@j=0;@j<RowCount("#BillComment");@j++)
- {
- SetPosition("#BillComment",@j);
- if(Equals(#BillComment.ID_BillComment,GuidEmpty()))
- {
- #BillComment.ID_BillComment=NewGuid();
- }
- #BillComment.ID_Bill=#PurchaseOrderBill.ID_PurchaseOrderBill;
- }
- for(@j=0;@j<RowCount("#ReportComment");@j++)
- {
- SetPosition("#ReportComment",@j);
- if(Equals(#ReportComment.ID_ReportComment,GuidEmpty()))
- {
- #ReportComment.ID_ReportComment=NewGuid();
- }
- #ReportComment.ID_Bill=#PurchaseOrderBill.ID_PurchaseOrderBill;
- }
- ResumeLayout();
- if(@Status==1)
- { #PurchaseOrderBill.CreateDate_PurchaseOrderBill=GetCurrentTime();
- #PurchaseOrderBill.No_PurchaseOrderBill = New("PurchaseOrderBill.No_PurchaseOrderBill",timeMake.CValue);
- }
- else if(@Status==3)
- {
- #PurchaseOrderBill.LastModUser=GetCurrentUser();
- #PurchaseOrderBill.LastModUser_PurchaseOrderBill=GetLoginUserID();
- #PurchaseOrderBill.LastModDate_PurchaseOrderBill=GetCurrentTime();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- <CountSum>
- <![CDATA[
- if (RowCount("#PurchaseOrderBillProduct") == 0)
- {
- txtNumSum.CValue=0;
- txtMoneySum.CValue=0;;
- txtTaxSum.CValue=0;
- txtSum.CValue=0;
- }
- else
- {
- txtNumSum.CValue = SumOfCol("#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct");
- switch (cbTaxCurrency.SelectedName)
- {
- case "外加":
- txtMoneySum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
- txtTaxSum.CValue=FormatNumber(txtMoneySum.CValue*@CessIn,@PriceDecimal);
- txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
- break;
- case "内含":
- txtSum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
- txtMoneySum.CValue=FormatNumber(txtSum.CValue/(1+@CessIn),@PriceDecimal);
- txtTaxSum.CValue=txtSum.CValue-txtMoneySum.CValue;
- break;
- case "零税":
- case "免税":
- txtMoneySum.CValue=SumOfCol("#PurchaseOrderBillProduct.Money");
- txtTaxSum.CValue=0;
- txtSum.CValue=txtMoneySum.CValue+txtTaxSum.CValue;
- break;
- }
- UpdateForm(false, "txtMoneySum");
- UpdateForm(false, "txtTaxSum");
- UpdateForm(false, "txtSum");
- }
- ]]>
- </CountSum>
- <AuditLable>
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#PurchaseOrderBillProduct");@i=@i+1)
- {
- SetPosition("#PurchaseOrderBillProduct", @i);
- if (#PurchaseOrderBillProduct.Type_FromBill != 0 && #PurchaseOrderBillProduct.No_FromBill!=StringEmpty() && Search("SearchPurchaseQueryBill",#PurchaseOrderBillProduct.No_FromBill))
- {
- if (Equals(#PurchaseQueryBill.ID_Assessor,DBNull()))
- {
- tbDetail.SelectedIndex = 1;
- dgProduct.CurrentRowIndex = @i;
- @ClickResult = MessageBox("该来源单据未经审核,确定要审核吗?",@Title,MB_OKCANCEL);
- if (@ClickResult == DialogResult("CANCEL"))
- {
- dgProduct.Focus();
- ResumeLayout();
- return;
- }
- }
- }
- }
- ResumeLayout();
- ]]>
- BeginAudit();
- #PurchaseOrderBill.ID_Assessor=GetLoginUserID();
- #PurchaseOrderBill.Assessor=GetCurrentUser();
- #PurchaseOrderBill.AssessDate_PurchaseOrderBill=DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
- <Lable name="CountSum"/>
- </AuditLable>
- </Lables>
- </Form>
- </Forms>
|