当前位置: 首页>>代码示例>>C#>>正文


C# Supplier.Payment方法代码示例

本文整理汇总了C#中Supplier.Payment方法的典型用法代码示例。如果您正苦于以下问题:C# Supplier.Payment方法的具体用法?C# Supplier.Payment怎么用?C# Supplier.Payment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Supplier的用法示例。


在下文中一共展示了Supplier.Payment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StatementMatch

 /// <summary>
 /// Update a matched transaction
 /// </summary>
 public void StatementMatch()
 {
     Utils.Check(SessionData.StatementMatch != null, "Invalid call to StatementMatch");
     MatchInfo match = SessionData.StatementMatch.ToObject<MatchInfo>();
     Account account = Database.Get<Account>(match.id);
     // The existing transaction to match (or empty record if none)
     Extended_Document transaction = match.transaction < 0 ? Database.EmptyRecord<Extended_Document>() :
         SessionData.StatementImport.transactions[match.transaction].ToObject<Extended_Document>();
     // The statement transaction
     dynamic current = SessionData.StatementImport.import[match.current];
     Utils.Check(current != null, "No current transaction");
     bool same = match.type == "Same";
     bool documentHasVat = false;
     bool payment = false;
     decimal cAmount = current.Amount;
     int id = transaction.idDocument ?? 0;
     DocType type = match.transaction < 0 ?
         match.type == "Transfer" ?
             DocType.Transfer :		// They specified a new transfer
             cAmount < 0 ?			// They specified a new transaction - type depends on sign and account type
                 account.AccountTypeId == (int)AcctType.Bank ?
                     DocType.Cheque : DocType.CreditCardCharge :
                 account.AccountTypeId == (int)AcctType.Bank ?
                     DocType.Deposit : DocType.CreditCardCredit :
         (DocType)transaction.DocumentTypeId;
     GetParameters["acct"] = match.id.ToString();	// This bank account
     // Call appropriate method to get Record, and therefore transaction
     // Also set Module and Method, so appropriate template is used to display transaction before posting
     switch (type) {
         case DocType.Payment:
             Module = "customer";
             Method = "payment";
             Customer cust = new Customer();
             cust.Payment(id);
             this.Record = cust.Record;
             payment = true;
             break;
         case DocType.BillPayment:
             Module = "supplier";
             Method = "payment";
             Supplier supp = new Supplier();
             supp.Payment(id);
             this.Record = supp.Record;
             payment = true;
             break;
         case DocType.Cheque:
         case DocType.Deposit:
         case DocType.CreditCardCharge:
         case DocType.CreditCardCredit:
             Method = "document";
             Document(id, type);
             documentHasVat = true;
             break;
         case DocType.Transfer:
             Method = "transfer";
             Transfer(id);
             break;
         default:
             throw new CheckException("Unexpected document type:{0}", type.UnCamel());
     }
     dynamic record = (JObject)Record;
     dynamic doc = record.header;
     if (id == 0 && type == DocType.Transfer && cAmount > 0) {
         // New transfer in
         doc.TransferAccountId = match.id;
         doc.DocumentAccountId = 0;
         doc.DocumentAccountName = "";
     }
     if (string.IsNullOrWhiteSpace(doc.DocumentMemo.ToString())) {
         // Generate a memo
         string name = current.Name;
         string memo = current.Memo;
         if (string.IsNullOrWhiteSpace(memo))
             memo = name;
         else if (!memo.Contains(name))
             memo = name + " " + memo;
         doc.DocumentMemo = memo;
     }
     if (!same) {
         // They want to create a new document - try to guess the DocumentName
         string name = doc.DocumentName;
         string currentName = current.Name;
         currentName = currentName.Split('\n', '\t')[0];
         if (string.IsNullOrWhiteSpace(name) || (!payment && name.SimilarTo(currentName) < 0.5)) {
             doc.DocumentName = currentName;
             NameAddress n = new NameAddress() {
                 Type = "O",
                 Name = currentName
             };
             doc.DocumentNameAddressId = Database.Get(n).idNameAddress ?? 0;
         }
     }
     doc.DocumentDate = current.Date;
     decimal tAmount = doc.DocumentAmount;
     decimal diff = Math.Abs(cAmount) - Math.Abs(tAmount);
     doc.DocumentAmount += diff;
     if(same)
//.........这里部分代码省略.........
开发者ID:nikkilocke,项目名称:AccountServer,代码行数:101,代码来源:Banking.cs


注:本文中的Supplier.Payment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。