Exemplo n.º 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);
     }
 }
Exemplo n.º 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()));
     }
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 5
0
 private static double GetTransactionAmount(OrderDetail orderLine, IWineMsTransactionLine transactionLine) =>
 (double)(orderLine.TaxMode == TaxMode.Exclusive ? transactionLine.TransactionAmountExVat : transactionLine.TransactionAmountInVat);
Exemplo n.º 6
0
 private static void SetGeneralLedgerAccount(OrderDetail orderLine, IWineMsTransactionLine transactionLine)
 {
     orderLine.GLAccount = new GLAccount(transactionLine.GeneralLedgerItemCode.EmptyIfNull().Trim());
 }
Exemplo n.º 7
0
 private static bool IsGeneralLedgerLine(IWineMsTransactionLine transactionLine) =>
 transactionLine.LineType.IsNullOrWhiteSpace() || transactionLine.LineType.ToUpper() == "GL";