//创建简单客户
static void CreateSampleCustTable(Args _args)
{
    CustTable                      customer;
    ContactPerson                  contactPerson;
    CustBankAccount                custBankAccount;
    DirPartyTable                  dirPartyTable;
    AccountNum                     AccountNum;
    ;
    AccountNum = "2019061803";
    customer.clear();
    customer.AccountNum         = AccountNum;
    customer.Blocked            = 0;
    customer.initValue();
    customer.Blocked            =   CustVendorBlocked::No;
    customer.CustGroup          = "10";//客户组
    customer.Currency           = "CNY";//币种
    customer.InclTax            = NoYes::Yes;//包含销售税
    customer.DlvTerm            = "";//交货条款
    customer.DlvMode            = "";//交货方式
    customer.taxGroup           = "No-Tax";//销售税组
    customer.PaymTermId         = "";//付款期限
    customer.PaymMode           = "";//付款方式
    customer.PaymDayId          = "";//付款日
    customer.SalesPoolId        = "";//销售订单池
    customer.BankAccount        = AccountNum;
    customer.DefaultDimension   = 0;
    customer.MainContactWorker  = 0;
    customer.insert();

    if (customer.RecId)
    {
        ttsBegin;
        dirPartyTable = DirPartyTable::findRec(customer.Party ,true);
        dirPartyTable.Name          = "客户名称";
        dirPartyTable.LanguageId    = "zh-hans";
        dirPartyTable.NameAlias     = "客户简称";
        dirPartyTable.update();
        ttsCommit;
    }

    contactPerson.clear();
    contactPerson.initValue();
    contactPerson.Party = customer.Party;
    contactPerson.initFromCustTable(customer);
    contactPerson.insert();

    custBankAccount.clear();
    custBankAccount.initValue();
    custBankAccount.AccountID   =  "AccountID";
    custBankAccount.Name        = "银行账户名称";
    custBankAccount.AccountNum  =  customer.BankAccount;
    custBankAccount.CustAccount = customer.AccountNum;
    custBankAccount.CurrencyCode= customer.Currency;
    custBankAccount.insert();
    info("创建成功。");
}

  

posted on 2019-10-30 11:40  Sunny_Li  阅读(279)  评论(0编辑  收藏  举报