protected void Page_Init(object sender, EventArgs e) { session = XpoHelper.GetNewSession(); dsInventory.Session = session; dsItemUnit.Session = session; treeInventory.DataBind(); dsInventory.CriteriaParameters["OrganizationId"].DefaultValue = "7e46b424-e0f5-4583-97f7-32bd2ec97e7e"; if (!IsPostBack) { Session["InventorySelected"] = "FA31071D-6010-4788-83B9-9F0CE0C90C5F"; //Khoa mặc định string defaultKey = Guid.Parse(Session["InventorySelected"].ToString()).ToString().Replace("-", string.Empty); TreeListNode node = treeInventory.FindNodeByKeyValue(defaultKey); if (node != null) { node.Focus(); } ItemUnits = InventoryTransactionBO.getItemUnitsInInventory(session, Guid.Parse(Session["InventorySelected"].ToString())); } System.Diagnostics.Debug.WriteLine(String.Format("Pageload InventoryId: {0}", Session["InventorySelected"].ToString())); this.grdataproduct.DataSource = ItemUnits; this.grdataproduct.DataBind(); //grdBalanceOfItems.DataSource = InventoryJournals; //grdBalanceOfItems.DataBind(); grdBalanceOfInventoryCart.DataSource = InventoryLedgers; grdBalanceOfInventoryCart.DataBind(); }
public void CreatePurchaseInvoiceInventoryTransaction(Session session, Guid purchaseInvoiceId, Guid accountingPeriodId, DateTime issueDate, Guid inventoryId, XPCollection <BillItem> billItems, string code, string description) { InventoryTransactionBO invTransactionBO = new InventoryTransactionBO(); invTransactionBO.ReceiptType = Utility.Constant.RECEIPT_PURCHASE; //invTransactionBO.CreatePurchaseInvoiceInventoryTransaction(session, purchaseInvoiceId, accountingPeriodId, issueDate, inventoryId, billItems, code, description); invTransactionBO.CreateInventoryTransaction(session, inventoryId, code, description, issueDate, billItems); }
protected void GridDeliveryPlanning_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.Cancel = true; GridDeliveryPlanning.CancelEdit(); InventoryTransactionBO purchaseInvoiceTransactionBO = new InventoryTransactionBO(); purchaseInvoiceTransactionBO.UpdateInventoryTransaction(session, Guid.Parse(e.Keys["InventoryTransactionId"].ToString()), (DateTime)e.NewValues["IssueDate"], (string)e.NewValues["Code"], (string)e.NewValues["Description"]); GridDeliveryPlanning.DataSource = purchaseInvoiceTransactionBO.GetDeliveryPlanningForBill <PurchaseInvoice>(session, BillId); GridDeliveryPlanning.DataBind(); }
protected void GridDeliveryPlanning_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.Cancel = true; GridDeliveryPlanning.CancelEdit(); InventoryTransactionBO saleInvoiceTransactionBO = new InventoryTransactionBO(); saleInvoiceTransactionBO.CreateInventoryTransaction(session, BillId, (DateTime)e.NewValues["IssueDate"], (string)e.NewValues["Code"], (string)e.NewValues["Description"]); GridDeliveryPlanning.DataSource = saleInvoiceTransactionBO.GetDeliveryPlanningForBill <NAS.DAL.Invoice.SalesInvoice>(session, BillId); GridDeliveryPlanning.DataBind(); }
protected void grdataproduct_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { Inventory inventory = (Inventory)treeInventory.FocusedNode.DataItem; if (inventory != null) { Session["InventorySelected"] = inventory.InventoryId.ToString(); ItemUnits = InventoryTransactionBO.getItemUnitsInInventory(session, Guid.Parse(Session["InventorySelected"].ToString())); this.grdataproduct.DataSource = ItemUnits; this.grdataproduct.DataBind(); } }
protected void grdataproduct_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { Inventory inventory = (Inventory)treeInventory.FocusedNode.DataItem; if (inventory != null) { System.Diagnostics.Debug.WriteLine(String.Format("InventoryId: {0}, Name: {1}", inventory.InventoryId, inventory.Name)); Session["InventorySelected"] = inventory.InventoryId.ToString(); ItemUnits = InventoryTransactionBO.getItemUnitsInInventory(session, Guid.Parse(Session["InventorySelected"].ToString())); this.grdataproduct.DataSource = ItemUnits; this.grdataproduct.DataBind(); } }
public void DataBind() { if (BillId != null) { if (IsDetailBeforePerformDataSelect) { return; } InventoryCommandBO inventoryCommandBO = new InventoryCommandBO(); InventoryTransactionBO purchaseInvoiceTransactionBO = new InventoryTransactionBO(); GridDeliveryPlanning.DataSource = purchaseInvoiceTransactionBO.GetDeliveryPlanningForBill <PurchaseInvoice>(session, BillId); GridDeliveryPlanning.KeyFieldName = "InventoryTransactionId"; GridDeliveryPlanning.DataBind(); GridDeliveryActual.DataSource = inventoryCommandBO.GetActualInventoryJournalOfBill(session, BillId, NAS.DAL.CMS.ObjectDocument.DefaultObjectTypeCustomFieldEnum.INVENTORY_OUT_SALE_INVOICE); GridDeliveryActual.KeyFieldName = "InventoryJournalId"; GridDeliveryActual.DataBind(); } }
protected void GridDeliveryPlanning_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { NAS.DAL.Invoice.SalesInvoice bill = session.GetObjectByKey <NAS.DAL.Invoice.SalesInvoice>(BillId); try { InventoryTransactionBO saleInvoiceTransactionBO = new InventoryTransactionBO(); if (bill.RowStatus == 4) { throw (new Exception("Phiếu đã khóa, không thể thao tác")); } else { saleInvoiceTransactionBO.DeleteInventoryTransaction(session, Guid.Parse(e.Keys["InventoryTransactionId"].ToString())); } e.Cancel = true; GridDeliveryPlanning.DataSource = saleInvoiceTransactionBO.GetDeliveryPlanningForBill <NAS.DAL.Invoice.SalesInvoice>(session, BillId); GridDeliveryPlanning.DataBind(); } catch (Exception) { throw; } }