using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace HH.YiDaSyncNC.Models
{
public class FKYF_SyncServiceModel
{
#region 凭证数据模型
///
/// 凭证模型
///
public class DataModel
{
///
/// 头部
///
public class voucher_header
{
///
/// 应付财务组织
///
public string pk_org { get; set; }
///
/// 创建时间
///
public string creationtime { get; set; }
///
/// 创建人
///
public string creator { get; set; }
///
/// 单据日期
///
public string billdate { get; set; }
///
/// 制单人
///
public string billmaker { get; set; }
///
/// 单据号
///
public string billno { get; set; }
///
/// 原币金额
///
public string money { get; set; }
///
/// 组织本币金额
///
public string local_money { get; set; }
///
/// 单据会计年度
///
public string billyear { get; set; }
///
/// 单据会计期间
///
public string billperiod { get; set; }
///
/// 采购部门
///
public string pu_deptid { get; set; }
///
/// 采购业务员
///
public string pu_psndoc { get; set; }
///
/// 采购组织
///
public string pu_org { get; set; }
}
///
/// 明细分录
///
public class voucher_body
{
///
/// 应付财务组织
///
public string pk_org { get; set; }
///
/// 财务组织
///
public string pk_fiorg { get; set; }
///
/// 采购部门
///
public string pu_deptid { get; set; }
///
/// 采购组织
///
public string pu_org { get; set; }
///
/// 结算财务组织
///
public string sett_org { get; set; }
///
/// 物料
///
public string material { get; set; }
///
/// 供应商
///
public string supplier { get; set; }
///
/// 单据日期
///
public string billdate { get; set; }
///
/// 起算日期
///
public string busidate { get; set; }
///
/// 收支项目
///
public string pk_subjcode { get; set; }
///
/// 科目
///
public string subjcode { get; set; }
///
/// 单据分录号
///
public string rowno { get; set; }
///
/// 部门
///
public string pk_deptid { get; set; }
///
/// 业务员
///
public string pk_psndoc { get; set; }
///
/// 贷方数量
///
public string quantity_cr { get; set; }
///
/// 组织本币金额(贷方)
///
public string local_money_cr { get; set; }
///
/// 贷方原币金额
///
public string money_cr { get; set; }
///
/// 税额
///
public string local_tax_cr { get; set; }
///
/// 贷方原币无税金额
///
public string notax_cr { get; set; }
///
/// 组织本币无税金额(贷方)
///
public string local_notax_cr { get; set; }
///
/// 单价 无税
///
public string price { get; set; }
///
/// 含税单价
///
public string taxprice { get; set; }
///
/// 税率
///
public string taxrate { get; set; }
///
/// 订单供应商
///
public string ordercubasdoc { get; set; }
///
/// 发票号
///
public string invoiceno { get; set; }
///
/// 计税金额
///
public string caltaxmny { get; set; }
}
}
#endregion
public class ImportXml_应付单
{
public static XElement TemplateHeade(DataModel.voucher_header item)
{
return new XElement(new XElement("ufinterface", new object[]
{
new XAttribute("billtype","F1"),
new XAttribute("sender","dingding"),
new XAttribute("receiver",""),
new XAttribute("roottag",""),
new XAttribute("replace","N"),
new XAttribute("orgcode",""),
new XAttribute("isexchange",""),
new XAttribute("groupcode","0"),
new XAttribute("filename",""),
new XAttribute("businessunitcode","develop"),
new XAttribute("account","develop")
}));
}
///
/// 组建表头xml
///
/// 表头参数
///
public static XElement Header(DataModel.voucher_header item)
{
return new XElement("bill", new object[]
{
"",
new XElement("billhead", new object[]
{
new XElement("pk_group","0"),
new XElement("pk_org",item.pk_org),
new XElement("pk_fiorg",item.pk_org),
new XElement("sett_org",item.pk_org),
new XElement("creationtime",item.creationtime),
new XElement("creator",item.creator),
new XElement("billno",item.billno),
new XElement("billdate",item.billdate),
new XElement("billmaker",item.billmaker),
new XElement("money",item.money),
new XElement("local_money",item.local_money),
new XElement("billyear",item.billyear),
new XElement("billperiod",item.billperiod),
new XElement("pu_deptid",item.pu_deptid),
new XElement("pu_psndoc",item.pu_psndoc),
new XElement("pu_org",item.pu_org),
new XElement("isreded","N"),
new XElement("pk_billtype","F1"),
new XElement("pk_tradetype","D1"),
new XElement("billclass","yf"),
new XElement("accessorynum","0"),
new XElement("isflowbill","N"),
new XElement("isinit","N"),
new XElement("syscode","1"),
new XElement("src_syscode","1"),
new XElement("billstatus","1"),
new XElement("grouplocal","0.00000000"),
new XElement("globallocal","0.00000000"),
new XElement("grouprate","0.00000000"),
new XElement("globalrate","0.00000000"),
new XElement("rate","0.00000000"),
new XElement("ispuadjust","N"),
new XElement("coordflag","0"),
new XElement("pk_currtype","CNY"),
new XElement("bodys","")
}),
});
}
///
/// 组建表体xml
///
/// 表体
///
public static List Body(List items)
{
List list = new List();
foreach (DataModel.voucher_body current in items)
{
XElement item = new XElement("item", new object[]
{
new XElement("pk_org",current.pk_org),
new XElement("pk_fiorg",current.pk_fiorg),
new XElement("pu_deptid",current.pu_deptid),
new XElement("pu_org",current.pu_org),
new XElement("material",current.material),
new XElement("sett_org",current.sett_org),
new XElement("supplier",current.supplier),
new XElement("supplier",current.billdate),
new XElement("busidate",current.busidate),
new XElement("pk_subjcode",current.pk_subjcode),
new XElement("rowno",current.rowno),
new XElement("pk_deptid",current.pk_deptid),
new XElement("pk_psndoc",current.pk_psndoc),
new XElement("quantity_cr",current.quantity_cr),
new XElement("local_money_cr",current.local_money_cr),
new XElement("money_cr",current.money_cr),
new XElement("notax_cr",current.notax_cr),
new XElement("local_notax_cr",current.local_notax_cr),
new XElement("price",current.price),
new XElement("taxprice",current.taxprice),
new XElement("taxrate",current.taxrate),
new XElement("ordercubasdoc",current.ordercubasdoc),
new XElement("invoiceno",current.invoiceno),
new XElement("caltaxmny",current.caltaxmny),
new XElement("local_tax_cr",current.local_tax_cr),
new XElement("subjcode",current.subjcode),
new XElement("coordflag","0"),
new XElement("pk_group","0"),
new XElement("direction","0"),
new XElement("rowtype","0"),
new XElement("pk_billtype","F1"),
new XElement("billclass","yf"),
new XElement("pk_tradetype","D1"),
new XElement("objtype","1"),
new XElement("pk_currtype","CNY"),
new XElement("rate","1"),
new XElement("money_bal","0"),
new XElement("local_money_bal","0"),
new XElement("quantity_bal","0"),
new XElement("taxtype","0"),
new XElement("buysellflag","2"),
new XElement("grouprate","0.00000000"),
new XElement("globalrate","0.00000000"),
new XElement("groupcrebit","0.00000000"),
new XElement("globalcrebit","0.00000000"),
new XElement("groupbalance","0.00000000"),
new XElement("globalbalance","0.00000000"),
new XElement("groupnotax_cre","0.00000000"),
new XElement("globalnotax_cre","0.00000000"),
new XElement("occupationmny","0.00000000"),
});
list.Add(item);
}
return list;
}
}
}
}