static public Bill Parse(SupplyOrder order) { Assertion.AssertObject(order, "order"); if (order.Bill.IsEmptyInstance) { var bill = new Bill(); bill.supplyOrder = order; bill.Create(); order.Bill = bill; order.Save(); } return order.Bill; }
internal SupplyOrderItem(SupplyOrder order) { this.order = order; }
protected override void OnLoadObjectData(DataRow row) { this.order = SupplyOrder.Parse((int) row["SupplyOrderId"]); this.orderItemTypeId = (int) row["SupplyOrderItemTypeId"]; this.supplyPoint = Contact.Parse((int) row["ItemSupplyPointId"]); this.concept = (string) row["SupplyOrderItemConcept"]; this.applicationItemTypeId = (int) row["ApplicationItemTypeId"]; this.applicationItemId = (int) row["ApplicationItemId"]; this.commissioner = Person.Parse((int) row["CommissionerId"]); this.requestedDate = (DateTime) row["RequestedDate"]; this.promisedDate = (DateTime) row["PromisedDate"]; this.deliveryTime = (DateTime) row["DeliveryTime"]; if (this.order.Status == OrderStatus.Opened) { this.product = BaseObject.ParseFull<Product>((int) row["ProductId"]); } else { this.product = Product.Parse((int) row["ProductId"]); } this.quantity = (decimal) row["Quantity"]; this.presentationUnit = PresentationUnit.Parse((int) row["PresentationId"]); this.identificationTag = (string) row["IdentificationTag"]; this.dutyEntryTag = (string) row["DutyEntryTag"]; this.expirationDate = (DateTime) row["ExpirationDate"]; this.priceRuleId = (int) row["PriceRuleId"]; this.priceType = (PriceType) Convert.ToChar(row["PriceType"]); this.discountRuleId = (int) row["DiscountRuleId"]; this.discountType = (PriceType) Convert.ToChar(row["DiscountType"]); this.unitRepositionValue = (decimal) row["RepositionValue"]; this.productUnitPrice = (decimal) row["ProductUnitPrice"]; this.currency = Currency.Parse((int) row["BaseCurrencyId"]); this.productSubTotalInBaseCurrency = (decimal) row["ProductSubtotalBaseCurrency"]; this.productSubTotal = (decimal) row["ProductSubtotal"]; this.productDiscount = (decimal) row["ProductDiscount"]; this.productTaxes = (decimal) row["ProductTaxes"]; this.productTotal = (decimal) row["ProductTotal"]; this.shippingSubTotal = (decimal) row["ShippingSubtotal"]; this.shippingDiscount = (decimal) row["ShippingDiscount"]; this.shippingTaxes = (decimal) row["ShippingTaxes"]; this.shippingTotal = (decimal) row["ShippingTotal"]; this.priceAuthorizationId = (int) row["PriceAuthorizationId"]; this.keywords = (string) row["SupplyOrderItemKeywords"]; this.parentItemId = (int) row["ParentSupplyOrderItemId"]; this.postedBy = Contact.Parse((int) row["PostedById"]); this.postingTime = (DateTime) row["PostingTime"]; this.status = (OrderStatus) Convert.ToChar(row["SupplyOrderItemStatus"]); }
static public DataView GetSupplyOrdersItemsARPCrossed(SupplyOrder order) { return DataReader.GetDataView(DataOperation.Parse("qryARPSupplyOrderItemsARPCrossed", order.Id)); }
static internal int WriteSupplyOrder(SupplyOrder o) { var op = DataOperation.Parse("writeSNMSupplyOrder", o.Id, o.GetEmpiriaType().Id, o.Number, o.CustomerOrderNumber, o.DutyEntryTag, o.Concept, o.SupplyChannel.Id, o.SupplyPoint.Id, o.Supplier.Id, o.SupplierContact.Id, o.Customer.Id, o.CustomerContact.Id, o.DeliveryMode.Id, o.DeliveryTo.Id, o.DeliveryPoint.Id, o.DeliveryContact.Id, o.DeliveryTime, o.DeliveryNotes, o.AuthorizationId, o.Currency.Id, o.OrderingTime, o.ClosedBy.Id, o.ClosingTime, o.CanceledBy.Id, o.CancelationTime, o.Keywords, o.Payment.Id, o.Bill.Id, o.ExternalOrderId, o.Parent.Id, o.PostedBy.Id, o.PostingTime, (char) o.Status); return DataWriter.Execute(op); }
static internal SupplyOrderItemList GetSupplyOrderItems(SupplyOrder supplyOrder) { string sql = "SELECT * FROM SNMSupplyOrderItems WHERE SupplyOrderId = " + supplyOrder.Id; DataView view = DataReader.GetDataView(DataOperation.Parse(sql)); if (supplyOrder.Status == OrderStatus.Opened) { return new SupplyOrderItemList((x) => BaseObject.ParseDataRowFull<SupplyOrderItem>(x), view); } else { return new SupplyOrderItemList((x) => BaseObject.ParseDataRowFull<SupplyOrderItem>(x), view); } }