private void lkeUnitMeasurments_EditValueChanged(object sender, EventArgs e) { if (lkeInventoryItems.EditValue == null) { return; } DB_PriceType priceType = DB_PriceType.None; DB_InvoiceType invoiceType = (DB_InvoiceType)InvoiceTypeID; switch (invoiceType) { case DB_InvoiceType.SellingInvoice: case DB_InvoiceType.ReturningSellingInvoice: priceType = DB_PriceType.SellingPrice; break; case DB_InvoiceType.PurchasingInvoice: case DB_InvoiceType.ReturningPurchasingInvoice: priceType = DB_PriceType.PurchasingPrice; break; } Line_PricePerUnit = InventoryBusinessLogicEngine.GetInventoryItemSellingPrice(Line_InventoryItem_CU_ID, Line_UnitMeasurment_CU_ID, InvoiceCreationDate, Person_CU_ID, priceType); Line_InventoryItemAvaliableQuantity = Math.Floor(InventoryBusinessLogicEngine.GetInventoryItemAvailableQuantity(Line_InventoryItem_CU_ID, Line_UnitMeasurment_CU_ID, InventoryHousing_CU_ID)); UnitMeasurment_cu inventoryTrackingUnitMeasurment = InventoryBusinessLogicEngine.GetInventoryTrackingUnitMeasurment(Line_InventoryItem_CU_ID); if (inventoryTrackingUnitMeasurment == null) { txtEncapsulatedQuantity.EditValue = 1; } else { txtEncapsulatedQuantity.EditValue = InventoryBusinessLogicEngine.GetEncapsulatedQuantity(Line_UnitMeasurment_CU_ID, inventoryTrackingUnitMeasurment.ID); } }
private void lkeInventoryItems_EditValueChanged(object sender, EventArgs e) { if (lkeInventoryItems.EditValue == null) { lkeUnitMeasurments.Properties.DataSource = null; return; } List <UnitMeasurment_cu> unitMeasurmentList = InventoryBusinessLogicEngine.GetInventoryItemRegisteredUnitMeasurments(Convert.ToInt32(lkeInventoryItems.EditValue)); if (unitMeasurmentList == null || unitMeasurmentList.Count == 0) { XtraMessageBox.Show("لا يـوجـــد وحـدات قيــــاس مـربـوطــــة مـع هــذا المنتــــج", "تنبيـــــه", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, DefaultBoolean.Default); } CommonViewsActions.FillGridlookupEdit(lkeUnitMeasurments, unitMeasurmentList); DB_PriceType priceType = DB_PriceType.None; DB_InvoiceType invoiceType = (DB_InvoiceType)InvoiceTypeID; switch (invoiceType) { case DB_InvoiceType.SellingInvoice: case DB_InvoiceType.ReturningSellingInvoice: priceType = DB_PriceType.SellingPrice; break; case DB_InvoiceType.PurchasingInvoice: case DB_InvoiceType.ReturningPurchasingInvoice: priceType = DB_PriceType.PurchasingPrice; break; } Line_PricePerUnit = InventoryBusinessLogicEngine.GetInventoryItemSellingPrice(Line_InventoryItem_CU_ID, Line_UnitMeasurment_CU_ID, InvoiceCreationDate, Person_CU_ID, priceType); Line_InventoryItemAvaliableQuantity = Math.Floor(InventoryBusinessLogicEngine.GetInventoryItemAvailableQuantity(Line_InventoryItem_CU_ID, Line_UnitMeasurment_CU_ID, InventoryHousing_CU_ID)); UnitMeasurment_cu inventoryTrackingUnitMeasurment = InventoryBusinessLogicEngine.GetInventoryTrackingUnitMeasurment(Line_InventoryItem_CU_ID); if (inventoryTrackingUnitMeasurment != null) { txtInventoryTrackingUnitMeasurment.Text = inventoryTrackingUnitMeasurment.Name_P; } else { txtInventoryTrackingUnitMeasurment.Text = "لـم يحــدد"; } if (inventoryTrackingUnitMeasurment == null) { txtEncapsulatedQuantity.EditValue = 1; } else if (Line_UnitMeasurment_CU_ID != null) { txtEncapsulatedQuantity.EditValue = InventoryBusinessLogicEngine.GetEncapsulatedQuantity(Line_UnitMeasurment_CU_ID, inventoryTrackingUnitMeasurment.ID); } else { txtEncapsulatedQuantity.EditValue = 1; } }