示例#1
0
 private static void SetInventoryItem(OrderDetail orderLine, IWineMsTransactionLine transactionLine)
 {
     orderLine.InventoryItem = new InventoryItem(transactionLine.GeneralLedgerItemCode.EmptyIfNull().Trim());
     if (!transactionLine.WarehouseCode.IsNullOrWhiteSpace())
     {
         orderLine.Warehouse = new Warehouse(transactionLine.WarehouseCode);
     }
 }
示例#2
0
 private static Result <TaxRate> GetOrderLineTaxType(IWineMsTransactionLine transactionLine)
 {
     try {
         return(Result.Ok(new TaxRate(transactionLine.TaxTypeId)));
     }
     catch (Exception e) {
         e.LogException();
         return(Result.Fail <TaxRate>(e.GetExceptionMessages()));
     }
 }
示例#3
0
        private static void SetUnitSellingPrice(OrderDetail orderLine, IWineMsTransactionLine transactionLine)
        {
            var transactionAmount = GetTransactionAmount(orderLine, transactionLine);

            var unitSellingPrice =
                transactionAmount /
                (Math.Abs((double)transactionLine.Quantity) > 0.00
          ? (double)transactionLine.Quantity
          : 1);

            if (transactionLine.CurrencyCode.IsNullOrWhiteSpace())
            {
                orderLine.UnitSellingPrice = unitSellingPrice;
            }
            else
            {
                orderLine.UnitSellingPriceForeign = unitSellingPrice;
            }
        }
示例#4
0
        private static void SetUserDefinedFields(OrderTransactionType orderTransactionType, OrderDetail orderLine, IWineMsTransactionLine transactionLine)
        {
            switch (orderTransactionType)
            {
            case OrderTransactionType.SalesOrder:
                orderLine.SetUserField("ucIDSOrdTxCMwineMSGuid", $"{transactionLine.Guid}");
                break;

            case OrderTransactionType.PurchaseOrder:
                orderLine.SetUserField("ucIDPOrdTxCMwineMSGuid", $"{transactionLine.Guid}");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(orderTransactionType), orderTransactionType, null);
            }
        }
示例#5
0
 private static double GetTransactionAmount(OrderDetail orderLine, IWineMsTransactionLine transactionLine) =>
 (double)(orderLine.TaxMode == TaxMode.Exclusive ? transactionLine.TransactionAmountExVat : transactionLine.TransactionAmountInVat);
示例#6
0
 private static void SetGeneralLedgerAccount(OrderDetail orderLine, IWineMsTransactionLine transactionLine)
 {
     orderLine.GLAccount = new GLAccount(transactionLine.GeneralLedgerItemCode.EmptyIfNull().Trim());
 }
示例#7
0
 private static bool IsGeneralLedgerLine(IWineMsTransactionLine transactionLine) =>
 transactionLine.LineType.IsNullOrWhiteSpace() || transactionLine.LineType.ToUpper() == "GL";