private CalCommissionClient CalculateCommissionInvTran(InvTransClient tran, EmployeeCommission commission) { double amount; if (commission._FixedPrice != 0) { amount = -commission._FixedPrice * tran._Qty; } else { if (commission._IsRevenue) { amount = tran._NetAmount() * commission._Rate / -100d; } else { amount = tran.Margin * commission._Rate / -100d; } } if (amount == 0) { return(null); } var calCom = new CalCommissionClient(); calCom.SetMaster(tran); calCom._InvoiceNumber = tran._InvoiceNumber; calCom._Commission = Math.Round(amount, 2); return(calCom); }
private CalCommissionClient CalculateCommissionDebInvoice(DebtorInvoiceClient dic, EmployeeCommission commission) { double amount; if (commission._FixedPrice != 0) { amount = commission._FixedPrice; } else if (commission._IsRevenue) { amount = dic._NetAmountCur * commission._Rate / 100d; } else { amount = dic._Margin * commission._Rate / 100d; } if (amount == 0) { return(null); } var calCom = new CalCommissionClient(); calCom._CompanyId = dic.CompanyId; calCom._Employee = dic._Employee; calCom._Account = dic._DCAccount; calCom._InvoiceNumber = (int)dic._InvoiceNumber; calCom._Commission = Math.Round(amount, 2); return(calCom); }