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