@@ -46,6 +46,73 @@ namespace NX.ERP.U8.Store
}
public virtual void GetUnitPriceByTaxCost ( double iQuan , double itaxcost , double itaxrate , double iExchRate , out double iprice , out double itaxprice , out double isum )
{
try
{
var info = new NX . ERP . U8 . Account . Accinformation ( ) ;
iprice = info . FormatMoney ( itaxcost / ( 1.0 + itaxrate / 100.0 ) * iExchRate * iQuan ) ;
itaxprice = info . FormatMoney ( itaxcost / ( 1.0 + itaxrate / 100.0 ) * iExchRate * iQuan * ( itaxrate / 100.0 ) ) ;
isum = info . FormatMoney ( itaxcost * iExchRate * iQuan ) ;
}
catch ( Exception )
{
throw ;
}
}
public virtual void GetOriPriceByTaxCost ( double iQuan , double itaxcost , double itaxrate , out double iorimoney , out double ioritaxprice , out double iorisum , out double iunitcost )
{
try
{
var info = new Account . Accinformation ( ) ;
iorimoney = info . FormatMoney ( itaxcost / ( 1.0 + itaxrate / 100.0 ) * iQuan ) ;
ioritaxprice = info . FormatMoney ( itaxcost / ( 1.0 + itaxrate / 100.0 ) * iQuan * ( itaxrate / 100.0 ) ) ;
iorisum = info . FormatMoney ( itaxcost * iQuan ) ;
iunitcost = info . FormatUPrice ( itaxcost / ( 1.0 + itaxrate / 100.0 ) ) ;
}
catch ( Exception )
{
throw ;
}
}
public virtual void GetOriPriceByCost ( double iQuan , double iunitcost , double itaxrate , out double iorimoney , out double ioritaxprice , out double iorisum , out double itaxcost )
{
try
{
var info = new Account . Accinformation ( ) ;
iorimoney = info . FormatMoney ( iunitcost * iQuan ) ;
ioritaxprice = info . FormatMoney ( iunitcost * iQuan * ( itaxrate / 100.0 ) ) ;
iorisum = info . FormatMoney ( iunitcost * ( 1.0 + itaxrate / 100.0 ) * iQuan ) ;
itaxcost = info . FormatUPrice ( iunitcost * ( 1.0 + itaxrate / 100.0 ) ) ;
}
catch ( Exception )
{
throw ;
}
}
public virtual void GetUnitPriceByCost ( double iQuan , double iunitcost , double itaxrate , double iExchRate , out double iprice , out double itaxprice , out double isum )
{
try
{
var info = new NX . ERP . U8 . Account . Accinformation ( ) ;
iprice = info . FormatMoney ( iunitcost * iExchRate * iQuan ) ;
itaxprice = info . FormatMoney ( iunitcost * iExchRate * iQuan * ( itaxrate / 100.0 ) ) ;
isum = info . FormatMoney ( iunitcost * iExchRate * ( 1.0 + itaxrate / 100.0 ) * iQuan ) ;
}
catch ( Exception )
{
throw ;
}
}
/// <summary>
/// 保存一个采购到货单
@@ -53,49 +120,35 @@ namespace NX.ERP.U8.Store
/// <param name="puStoreIn"></param>
public void AddPuStoreIn ( Model . Store . PuStoreIn puStoreIn )
{
VoucherParameter voucherParameter = new VoucherParameter ( ) ;
voucherParameter . VoucherType = "01" ;
voucherParameter . DomHead = new DOMDocumentClass ( ) ;
voucherParameter . DomBody = new DOMDocumentClass ( ) ;
DOMDocument domHead = voucherParameter . DomHead ;
DOMDocument domBody = voucherParameter . DomBody ;
voucherParameter . DomHead . loadXML ( ReadFile ( AppDomain . CurrentDomain . BaseDirectory + "\\XMLDOM\\XMLDomHead01.xml" ) ) ;
voucherParameter . DomBody . loadXML ( ReadFile ( AppDomain . CurrentDomain . BaseDirectory + "\\XMLDOM\\XMLDomBody01.xml" ) ) ;
IXMLDOMElement iXMLDOMElement = domHead . createElement ( "z:row" ) ;
iXMLDOMElement . setAttribute ( "id" , "11" ) ; //DomHead[0]["id"] = ""; //主关键字段 , int类型
iXMLDOMElement . setAttribute ( "bom first" , "0" ) ; //DomHead[0]["bom first"] = ""; //委外 期初标志, string类型
iXMLDOMElement . setAttribute ( "ccode" , "211" ) ; //DomHead[0]["ccode "] = ""; //入库单号, str ing 类型
iXMLDOMElement . setAttribute ( "ddat e" , puStoreIn . Date . ToShortDateString ( ) ) ; //DomHead[0]["ddat e"] = ""; //入库日期, DateTime 类型
iXMLDOMElement . setAttribute ( "iverifystate" , 1 ) ; //DomHead[0]["iverifystate"] = ""; //iverifystate, int 类型
iXMLDOMElement . setAttribute ( "iswfcontrolle d" , 1 ) ; //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled, int类型
//iXMLDOMElement.setAttribute("cbustype", "0"); //DomHead[0]["cbustype"] = ""; //业务类型, int类型
//iXMLDOMElement.setAttribute("iexchrate", 1); //DomHead[0]["iexchrate"] = ""; //汇率, double类型
//iXMLDOMElement.setAttribute("cexch_name", "人民币"); //DomHead[0]["cexch_name"] = ""; //币种, string类型
//iXMLDOMElement.setAttribute("ufts", "asdasd"); //DomHead[0]["ufts"] = ""; //时间戳, string类型
iXMLDOMElement . setAttribute ( "bpufirst " , "0 " ) ; //DomHead[0]["bpufirst"] = ""; //采购期初标志, string类型
iXMLDOMElement . setAttribute ( "cvouchtype" , "01" ) ; //DomHead[0]["cvouchtype"] = ""; //单据类型, string类型
iXMLDOMElement . setAttribute ( "brdflag" , 1 ) ; //DomHead[0]["brdflag"] = ""; //收发标志, int类型
iXMLDOMElement . setAttribute ( "csource" , puStoreIn . Source ) ; //DomHead[0]["csource"] = ""; //单据来源, int类型
iXMLDOMElement . setAttribute ( "cmaker" , U8LoginContext . Instance . LoginUserName ) ; //DomHead[0]["cmaker"] = ""; //制单人, string类型
iXMLDOMElement . setAttribute ( "vt_id" , "27" ) ;
iXMLDOMElement . setAttribute ( "editprop" , "A" ) ;
iXMLDOMElement . setAttribute ( "cdepcode" , puStoreIn . Depcode ) ;
iXMLDOMElement . setAttribute ( "cpersoncode" , puStoreIn . PersonCode ) ;
iXMLDOMElement . setAttribute ( "crdcode" , puStoreIn . RdCode ) ;
iXMLDOMElement . setAttribute ( "cwhcode" , "1" ) ;
iXMLDOMElement . setAttribute ( "bisstqc" , "0" ) ;
iXMLDOMElement . setAttribute ( "bomfirst" , "0" ) ;
IXMLDOMElement headXml = domHead . createElement ( "z:row" ) ;
headXml . setAttribute ( "cvouchtype" , "01" ) ; //DomHead[0]["cvouchtype"] = ""; //单据类型, string类型
headXml . setAttribute ( "id" , puStoreIn . Id ) ; //DomHead[0]["id"] = ""; //主关键字段, int类型
headXml . setAttribute ( "bomfirst" , "0" ) ; //DomHead[0]["bomfirst"] = ""; //委外期初标志, string类型
headXml . setAttribute ( "ccode" , puStoreIn . Code ) ; //DomHead[0]["ccode"] = ""; //入库单号, string类型
headXml . setAttribute ( "ddate" , puStoreIn . Date . ToShortDateString ( ) ) ; //DomHead[0]["ddate"] = ""; //入库日期, DateTime类型
headXml . setAttribute ( "iverifystate" , 0 ) ; //DomHead[0]["iverifystate"] = ""; //iverifystate, int类型
headXml . setAttribute ( "iswfcontrolle d" , 0 ) ; //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled , int类型
headXml . setAttribute ( "bpu first" , "0" ) ; //DomHead[0]["bpu first"] = ""; //采购 期初标志, string类型
headXml . setAttribute ( "brdflag" , 1 ) ; //DomHead[0]["brdflag "] = ""; //收发标志, int 类型
headXml . setAttribute ( "csourc e" , puStoreIn . Source ) ; //DomHead[0]["csourc e"] = ""; //单据来源, int 类型
headXml . setAttribute ( "cmaker" , U8LoginContext . Instance . LoginUserName ) ; //DomHead[0]["cmaker"] = ""; //制单人, str ing 类型
headXml . setAttribute ( "vt_i d" , "27" ) ;
headXml . setAttribute ( "editprop" , "A" ) ;
headXml . setAttribute ( "cdepcode" , puStoreIn . Depcode ) ;
headXml . setAttribute ( "cpersoncode" , puStoreIn . PersonCode ) ;
headXml . setAttribute ( "crdcode" , puStoreIn . RdCode ) ;
headXml . setAttribute ( "cwhcode " , "1 " ) ;
headXml . setAttribute ( "bisstqc" , "0" ) ;
if ( puStoreIn . Source = = "采购到货单" )
{
var Arrival = new Purchase . ArrivalDAL ( ) . GetModel ( puStoreIn . SourceCode ) ;
@@ -103,73 +156,122 @@ namespace NX.ERP.U8.Store
//iXMLDOMElement.setAttribute("cvencode", puStoreIn.SupplierCode); //DomHead[0]["cvencode"] = ""; //供货单位编码, string类型
//iXMLDOMElement.setAttribute("cvenabbname", puStoreIn.SupplierName);//DomHead[0]["cvenabbname"] = ""; //供货单位, string类型
iXMLDOMElement . setAttribute ( "cbustype" , Arrival . SupplierCod e) ;
iXMLDOMElement . setAttribute ( "iexchrate" , Arrival . ExchRate ) ;
iXMLDOMElement . setAttribute ( "cexch_name" , Arrival . ExchName ) ;
iXMLDOMElement . setAttribute ( "cvencode" , Arrival . VenCode ) ;
headXml . setAttribute ( "cbustype" , Arrival . BusTyp e) ;
headXml . setAttribute ( "iexchrate" , Arrival . ExchRate ) ;
headXml . setAttribute ( "cexch_name" , Arrival . ExchName ) ;
headXml . setAttribute ( "cvencode" , Arrival . VenCode ) ;
headXml . setAttribute ( "carvcode" , Arrival . ArrivalCode ) ;
headXml . setAttribute ( "ipurarriveid" , Arrival . Id ) ;
headXml . setAttribute ( "darvdate" , Arrival . Date ) ;
headXml . setAttribute ( "itaxrate" , Arrival . TaxRate ) ;
iXMLDOMElement . setAttribute ( "carv code" , Arrival . Arrival Code) ;
iXMLDOMElement . setAttribute ( "ipurarriveid" , Arrival . Id ) ;
iXMLDOMElement . setAttribute ( "darvdate" , Arrival . Date ) ;
iXMLDOMElement . setAttribute ( "itaxrate" , Arrival . TaxRate ) ;
headXml . setAttribute ( "cpt code" , Arrival . PT Code) ;
iXMLDOMElement . setAttribute ( "cptcode" , Arrival . PTCode ) ;
domHead . selectSingleNode ( "//rs:data" ) . appendChild ( iXMLDOMElement ) ;
domHead . selectSingleNode ( "//rs:data" ) . appendChild ( headXml ) ;
IXMLDOMElement bodyXml ;
for ( var n = 0 ; n < puStoreIn . PuStoreInDetails . Count ; n + + )
{
var detail = puStoreIn . PuStoreInDetails [ n ] ;
var arrivalDetail = Arrival . ArrivalDetails . First ( m = > { return m . Id = = detail . SorceDetailId ; } ) ;
( domHead . selectSingleNode ( "//z:row" ) as IXMLDOMElement ) . setAttribute ( "cordercode" , arrivalDetail . OrderCode ) ;
( domHead . selectSingleNode ( "//z:row" ) as IXMLDOMElement ) . setAttribute ( "ipurorderid" , arrivalDetail . PoId ) ;
iXMLDOMElement = domBody . createElement ( "z:row" ) ;
iXMLDOMElement . setAttribute ( "cinvcode" , detail . Invcode ) ;
iXMLDOMElement . setAttribute ( "iquantity" , detail . Quantity ) ;
iXMLDOMElement . setAttribute ( "irowno" , n ) ;
iXMLDOMElement . setAttribute ( "cbvencode" , "10001" ) ;
iXMLDOMElement. setAttribute( "cbatch" , detail . Batch ) ;
iXMLDOMElement . setAttribute ( "carvcode" , Arrival . ArrivalCode ) ;
iXMLDOMElement . setAttribute ( "cbarvcode " , Arrival . ArrivalCode ) ;
iXMLDOMElement . setAttribute ( "ipurarriveid" , Arrival . Id ) ;
iXMLDOMElement . setAttribute ( "i arrsid " , detail . SorceDetailId ) ;
iXMLDOMElement . setAttribute ( "darvdate" , DateTime . Today . ToShortDateString ( ) ) ;
iXMLDOMElement . setAttribute ( "editprop" , "A" ) ;
iXMLDOMElement . setAttribute ( "c poid" , arrivalDetail . OrderCode ) ;
iXMLDOMElement . setAttribute ( "iposid " , a rrivalDetail . posId ) ;
var info = new NX . ERP . U8 . Account. Accinformation ( ) ;
//iorimoney = FormatMoney(iunitcost * iQuan);
//ioritaxprice = FormatMoney(iunitcost * iQuan * (itaxrate / 100.0));
//iorisum = FormatMoney(iunitcost * (1.0 + itaxrate / 100.0) * iQuan);
//itaxcost = FormatUPrice(iunitcost * (1.0 + itaxrate / 100.0));
headXml . setAttribute ( "cordercode" , arrivalDetail . OrderCode ) ;
// headXml.setAttribute("ipurorderid", arrivalDetail.PoId) ;
bodyXml = domBody . createElement ( "z:row" ) ;
bodyXml . setAttribute ( "cinvcode" , detail . Invcode ) ;
bodyXml . setAttribute ( "iquantity" , detail . Quantity ) ;
bodyXml . setAttribute ( "irowno" , n ) ;
bodyXml . setAttribute ( "cbvencode" , "10001" ) ;
bodyXml . setAttribute ( "inquantity" , detail . Quantity ) ; //应收数量, double类型
bodyXml . setAttribute ( "cbatch" , detail . Batch ) ;
bodyXml . setAttribute ( "innum" , 0 ) ;
// iXMLDOMElement. setAttribute("carvcode", Arrival.ArrivalCode) ;
bodyXml . setAttribute ( "cb arvcode" , Arrival . ArrivalCode ) ;
bodyXml . setAttribute ( "ipurarriveid " , Arrival . Id ) ;
bodyXml . setAttribute ( "iarrsid" , detail . SorceDetail Id ) ;
bodyXml . setAttribute ( "d arvdate " , DateTime . Today . ToShortDateString ( ) ) ;
bodyXml . setAttribute ( "editprop" , "A" ) ;
bodyXml . setAttribute ( "cpoid" , arrivalDetail . OrderCode ) ;
bodyXml . setAttribute ( "i pos id" , arrivalDetail . posId ) ;
bodyXml . setAttribute ( "itaxrate " , A rrival. TaxRate ) ;
var info = new Account . Accinformation ( ) ;
var iorisum = info . FormatMoney ( arrivalDetail . oricost * ( 1.00 + ( Arrival . TaxRate / 100.0 ) ) * detail . Quantity ) ;
var ioritaxprice = info . FormatMoney ( arrivalDetail . oricost * ( Arrival . TaxRate / 100.0 ) * detail . Quantity ) ;
var iorimoney = info . FormatMoney ( arrivalDetail . oricost * detail . Quantity ) ;
var oritaxcost = info . FormatMoney ( arrivalDetail . oricost * ( 1.00 + ( Arrival . TaxRate / 100.0 ) ) ) ;
iXMLDOMElement . setAttribute ( "ioricost" , arrivalDetail . oricost ) ;
iXMLDOMElement . setAttribute ( "ioritaxcost" , oritaxcost ) ;
iXMLDOMElement . setAttribute ( "iorimoney" , iorimoney ) ;
iXMLDOMElement . setAttribute ( "ioritax price" , ioritax price ) ;
iXMLDOMElement . setAttribute ( "iorisum" , iorisum ) ;
domBody . selectSingleNode ( "//rs:data" ) . appendChild ( iXMLDOMElement ) ;
double iprice2 ;
double itaxprice2 ;
double isum2 ;
GetUnitPriceByCost ( detail . Quantity , arrivalDetail . oricost , Arrival . TaxRate , Arrival . ExchRate , out iprice2 , out itaxprice2 , out isum2 ) ;
bodyXml . setAttribute ( "iunitcost" , arrivalDetail . cost ) ;
bodyXml . setAttribute ( "iprice" , iprice2 ) ;
bodyXml . setAttribute ( "facost" , arrivalDetail . cost ) ;
bodyXml . setAttribute ( "iaprice" , iprice2 ) ;
bodyXml . setAttribute ( "itaxprice" , itaxprice2 ) ;
bodyXml . setAttribute ( "isum" , isum2 ) ;
//double price;
//double taxprice;
//double sum;
//GetUnitPriceByCost(detail.Quantity, arrivalDetail.cost, Arrival.TaxRate, Arrival.ExchRate, out price, out taxprice, out sum);
//bodyXml.setAttribute("iunitcost", arrivalDetail.cost); //本币单价, double类型
//bodyXml.setAttribute("iprice", price); //本币金额, double类型
//bodyXml.setAttribute("facost", arrivalDetail.cost); //暂估单价, double类型
//bodyXml.setAttribute("itaxprice", taxprice);//本币税额, double类型
//bodyXml.setAttribute("isum", sum);//本币价税合计, double类型
double iorimoney2 ;
double ioritaxprice2 ;
double iorisum2 ;
double iunitcost2 ;
GetOriPriceByCost ( detail . Quantity , arrivalDetail . oricost , Arrival . TaxRate , out iorimoney2 , out ioritaxprice2 , out iorisum2 , out iunitcost2 ) ;
bodyXml . setAttribute ( "ioricost" , arrivalDetail . oricost ) ;
bodyXml . setAttribute ( "ioritaxcost" , arrivalDetail . oritaxcost ) ;
bodyXml . setAttribute ( "iorimoney" , iorimoney2 ) ;
bodyXml . setAttribute ( "ioritaxprice" , ioritaxprice2 ) ;
bodyXml . setAttribute ( "iorisum" , iorisum2 ) ;
//var iorisum = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)) * detail.Quantity);
//var ioritaxprice = info.FormatMoney(arrivalDetail.oricost * (Arrival.TaxRate / 100.0) * detail.Quantity);
//var iorimoney = info.FormatMoney(arrivalDetail.oricost * detail.Quantity);
//var oritaxcost = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)));
//double money;
//double taxcost;
//GetOriPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, out money, out taxprice, out sum, out taxcost);
//bodyXml.setAttribute("ioricost", arrivalDetail.oricost);
//bodyXml.setAttribute("ioritaxcost", arrivalDetail.oritaxcost);
//bodyXml.setAttribute("iorimoney", money);
//bodyXml.setAttribute("ioritaxprice", taxprice);
//bodyXml.setAttribute("iorisum", sum);
domBody . selectSingleNode ( "//rs:data" ) . appendChild ( bodyXml ) ;
}
}
var str = voucherParameter . DomBody . xml ;
Console . WriteLine ( str ) ;
U8LoginContext . Instance . AddRdVoucher ( "U8API/PuStoreIn/Add" , voucherParameter ) ;
try
{
U8LoginContext . Instance . AddRdVoucher ( "U8API/PuStoreIn/Add" , voucherParameter ) ;
}
catch ( Exception err )
{
throw err ;
}
}
public void Loadd ( )
public void LoadTemplate ( )
{
VoucherParameter rdVoucherParameter = null ;