private void gridOrderListView_FocusedRowChanged(object sender,
                                                         DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridOrderListView.GetFocusedDataRow();

            if (dr != null)
            {
                int        receiptID  = Convert.ToInt32(dr["ID"]);
                ReceiveDoc receiveDoc = new ReceiveDoc();
                receiveDoc.LoadAllByReceiptID(receiptID);
                DataTable         tbl = receiveDoc.DefaultView.ToTable();
                ReceiveDocDeleted receiveDocDeleted = new ReceiveDocDeleted();
                receiveDocDeleted.LoadAllByReceiptID(receiptID);

                LogReceiptStatus logReceiptStatus = new LogReceiptStatus();
                gridHistory.DataSource = logReceiptStatus.GetLogHistory(receiptID);

                if (receiveDocDeleted.RowCount > 0)
                {
                    tbl.Merge(receiveDocDeleted.DefaultView.ToTable());
                    BLL.User user = new User();
                    user.LoadByPrimaryKey(receiveDocDeleted.DeletedBy);
                    if (user.RowCount > 0)
                    {
                        lblDeletedBy.Text = string.Format("Deleted By {0}",
                                                          string.IsNullOrEmpty(user.FullName)
                                                              ? user.UserName
                                                              : user.FullName);
                    }
                }

                gridOrderDetail.DataSource = tbl;
            }
        }
        private void gridGRVs_MouseClick(object sender, MouseEventArgs e)
        {
            DataRow SelectGRV = gridGRVsView.GetFocusedDataRow();

            if (SelectGRV != null)
            {
                ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]);
                PONumber  = Convert.ToString(SelectGRV["PONumber"]);
                LoadSelectedGRVDetailForInvoiceEntry(ReceiptID);
                string s = "";

                HeaderSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.PadRight(180) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString();

                lblMode.Text          = (string)SelectGRV["Mode"];
                lblAccount.Text       = (string)SelectGRV["AccountName"];
                lblSubAccount.Text    = (string)SelectGRV["SubAccountName"];
                lblActivity.Text      = (string)SelectGRV["ActivityName"];
                lblWarehouse.Text     = (string)SelectGRV["WarehouseName"];
                lblCluster.Text       = (string)SelectGRV["ClusterName"];
                lblReceiptType.Text   = (string)SelectGRV["ReceiveType"];
                lblRecieptStatus.Text = (string)SelectGRV["ReceiveStatus"];
                lblSupplier.Text      = (string)SelectGRV["SupplierName"];
                lblOrderNo.Text       = (string)SelectGRV["PONumber"];

                var logReceiptStatus = new LogReceiptStatus();
                var dtHistory        = logReceiptStatus.GetLogHistory(ReceiptID, "PRC");

                if (dtHistory != null && dtHistory.Count > 0)
                {
                    lblCalculatedBy.Text   = (string)dtHistory[0]["FullName"];
                    lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString();
                }
                else
                {
                    lblCalculatedDate.Text = lblCalculatedBy.Text = "-";
                }

                lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"];
                DateTime confirmedTime;

                if (DateTime.TryParse(SelectGRV["ConfirmedTime"] == DBNull.Value ? "-" : SelectGRV["ConfirmedTime"].ToString(), out confirmedTime))
                {
                    lblConfirmedDate.Text = confirmedTime.ToShortDateString();
                }

                lblReceivedBy.Text  = (string)SelectGRV["ReceivedBy"];
                lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString();
                lblInsurance.Text   = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"];
            }
            else
            {
                ResetForm();
            }
        }
Exemple #3
0
        private void gridGRVs_MouseClick(object sender, MouseEventArgs e)
        {
            DataRow SelectGRV = gridGRVsView.GetFocusedDataRow();

            if (SelectGRV != null)
            {
                ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]);
                PONumber  = Convert.ToString(SelectGRV["PONumber"]);
                LoadSelectedGRVDetailForInvoiceEntry(ReceiptID);

                txtOrderNo.EditValue = SelectGRV["PONumber"];

                txtInvoiceNo.EditValue = SelectGRV["InvoiceNumber"];
                string space  = "";
                int    length = ((string)SelectGRV["InvoiceNumber"]).Length;
                lcgInvoiceNo.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + space.PadRight(180 - length) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString();


                lblMode.Text       = (string)SelectGRV["Mode"] ?? "-";
                lblAccount.Text    = (string)SelectGRV["AccountName"] ?? "-";
                lblSubAccount.Text = (string)SelectGRV["SubAccountName"] ?? "-";
                lblActivity.Text   = (string)SelectGRV["ActivityName"] ?? "-";
                lblWarehouse.Text  = (string)SelectGRV["WarehouseName"] ?? "-";

                lblCluster.Text       = (string)SelectGRV["ClusterName"] ?? "-";
                lblReceiptType.Text   = (string)SelectGRV["ReceiveType"] ?? "-";
                lblReceiptStatus.Text = (string)SelectGRV["ReceiveStatus"] ?? "-";
                lblSupplier.Text      = (string)SelectGRV["SupplierName"] ?? "-";
                lblOrderNo.Text       = (string)SelectGRV["PONumber"] ?? "-";


                lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"];

                lblConfirmedDate.Text = SelectGRV["ConfirmedTime"] != DBNull.Value
                    ? Convert.ToDateTime(SelectGRV["ConfirmedTime"]).ToShortDateString()
                    : "-";

                lblReceivedBy.Text  = (string)SelectGRV["ReceivedBy"] ?? "-";
                lblReceiptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString() ?? "-";
                lblInsurance.Text   = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"] ?? "-";


                txtInsuranceNo.EditValue  = SelectGRV["InsuranceNumber"];
                lblInsurancePolicyNo.Text = SelectGRV["InsuranceNumber"].ToString() ?? "-";
                txtTransfer.EditValue     = SelectGRV["TransitNumber"];
                lblTransferNo.Text        = SelectGRV["TransitNumber"].ToString() ?? "-";
                txtWayBill.EditValue      = SelectGRV["WayBillNumber"];
                lblWayBillNo.Text         = SelectGRV["WayBillNumber"].ToString() ?? "-";
                Activity Activity = new Activity();
                Activity.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["StoreID"]));
                txtActivity.EditValue = Activity.FullActivityName;
                lblActivity.Text      = Activity.FullActivityName ?? "-";

                var logReceiptStatus = new LogReceiptStatus();
                var dtHistory        = logReceiptStatus.GetLogHistory(ReceiptID, "PRC");

                if (dtHistory != null && dtHistory.Count > 0)
                {
                    lblCalcuatedBy.Text    = (string)dtHistory[0]["FullName"];
                    lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString();
                }
                else
                {
                    lblCalculatedDate.Text = lblCalcuatedBy.Text = "-";
                }
            }
            else
            {
                ResetForm();
            }
        }
Exemple #4
0
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();

            try
            {
                ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                var         rd         = new ReceiveDoc();
                rd.LoadByReceiptID(ReceiptID);

                var ps = new PhysicalStore();
                ps.LoadByPrimaryKey(rd.PhysicalStoreID);

                var w = new BLL.Warehouse();
                w.LoadByPrimaryKey(ps.PhysicalStoreTypeID);
                lblWarehouse.Text = w.Name ?? "-";

                var c = new Cluster();
                c.LoadByPrimaryKey(w.ClusterID);
                lblCluster.Text = c.Name ?? "-";



                receiptDoc.LoadByPrimaryKey(ReceiptID);
                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();
                gridDetails.DataSource  = GRNFDetail;
                gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]);

                var SelectGRV = gridReceiveView.GetFocusedDataRow();

                lblMode.Text       = (string)SelectGRV["ModeName"];
                lblAccount.Text    = (string)SelectGRV["AccountName"];
                lblSubAccount.Text = (string)SelectGRV["SubAccountName"];
                lblActivity.Text   = (string)SelectGRV["ActivityName"];
                lblSupplier.Text   = (string)SelectGRV["SupplierName"];
                lblPONumber.Text   = (string)SelectGRV["PONo"];

                lblType.Text   = (string)SelectGRV["ReceiptType"];
                lblStatus.Text = (string)SelectGRV["CurrentStatus"];

                var lgs = new LogReceiptStatus();
                lgs.LoadByReceiptID(ReceiptID);

                lblCalculatedDate.Text = lgs.StatusChangedDate.ToShortDateString();



                var user = new User();
                if (SelectGRV["calculatedBy"] != DBNull.Value)
                {
                    user.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["calculatedBy"]));
                    lblCalculatedBy.Text = user.FullName;
                }

                else
                {
                    lblCalculatedBy.Text = "-";
                }

                lblCostConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-";

                //lblGRVNumber.Text = reference;
                //lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString();
                lblCostConfirmedDate.Text = SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-";


                string s = "";

                int    length = ((string)SelectGRV["STVOrInvoiceNo"]).Length;
                string grv    = (Convert.ToInt32(SelectGRV["IDPrinted"])).ToString();
                HeaderGroup.Text = "Invoice No: " + (string)SelectGRV["STVOrInvoiceNo"] + s.PadRight(240 - length) + "GRV No: " + grv;



                //ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);
                //ds = new DataSet();
                //DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID);
                //dvMaster.TableName = "Master";
                //ds.Tables.Add(dvMaster);
                //gridDetails.DataSource = ds.Tables[dvMaster.TableName];



                //var receipt = new BLL.Receipt();
                //receipt.LoadByPrimaryKey(ReceiptID);
                //int receiptTypeID = receipt.ReceiptTypeID;



                if (currentMode == Modes.GRVPrinting)
                {
                    if (status != ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED)
                    {
                        gridDetails.Enabled = false;

                        btnConfirm.Enabled = false;
                        btnPrint.Enabled   = false;
                        btnReturn.Enabled  = false;
                    }
                    else
                    {
                        gridDetails.Enabled = true;
                        btnConfirm.Enabled  = true;
                        btnPrint.Enabled    = true;
                        btnReturn.Enabled   = true;
                    }
                }
            }

            catch
            {
                gridDetails.DataSource  = null;
                gridShortage.DataSource = null;
            }
        }
Exemple #5
0
        private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            var pl = new PalletLocation();

            ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);

            try
            {
                //B1A data
                var    SelectGRV = gridReceiveView.GetFocusedDataRow();
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();
                lblGRVNo.Text      = reference;
                lblMode.Text       = (string)SelectGRV["ModeName"];
                lblAccount.Text    = (string)SelectGRV["AccountName"];
                lblSubAccount.Text = (string)SelectGRV["SubAccountName"];
                lblActivity.Text   = (string)SelectGRV["ActivityName"];
                lblSupplier.Text   = (string)SelectGRV["SupplierName"];
                lblPoNumber.Text   = (string)SelectGRV["PONo"];
                lblCluster.Text    = (string)SelectGRV["ClusterName"];
                lblWarehouse.Text  = (string)SelectGRV["WarehouseName"];
                lblStore.Text      = (string)SelectGRV["PhysicalStoreName"];
                lblType.Text       = (string)SelectGRV["ReceiptType"];
                lblStatus.Text     = (string)SelectGRV["ReceiptStatus"];

                var logReceiptStatus = new LogReceiptStatus();
                var dtHistory        = logReceiptStatus.GetLogHistory(ReceiptID, "PRC");

                if (dtHistory != null && dtHistory.Count > 0)
                {
                    lblCalculatedBy.Text   = (string)dtHistory[0]["FullName"];
                    lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString();
                }
                else
                {
                    lblCalculatedDate.Text = lblCalculatedBy.Text = "-";
                }

                var receiveDoc = new ReceiveDoc();
                receiveDoc.LoadByReceiptID(Convert.ToInt32(SelectGRV["ReceiptID"]));
                lblConfirmedDate.Text = receiveDoc.ConfirmedDateTime.ToString() != "" ? receiveDoc.ConfirmedDateTime.ToShortDateString() : "-";


                lblConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-";
                lblGRVNumber.Text   = reference;
                lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString();


                // lblConfirmedDate.Text =SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-";

                ds = new DataSet();
                DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID);
                dvMaster.TableName = "Master";
                ds.Tables.Add(dvMaster);
                gridDetails.DataSource = ds.Tables[dvMaster.TableName];


                int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]);
                try
                {
                    StoreID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["StoreID"]);
                }
                catch
                {
                }

                var receipt = new BLL.Receipt();
                receipt.LoadByPrimaryKey(ReceiptID);
                int receiptTypeID = receipt.ReceiptTypeID;
            }

            catch
            {
                gridDetails.DataSource = null;
            }

            //reset
            btnCancelVoidRequest.Enabled = true;
            btnVoidRequest.Enabled       = true;
            btnVoid.Enabled       = true;
            btnReprintGRV.Enabled = true;

            if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["isreprint"].ToString()))
            {
                btnReprintGRV.Enabled = false;
            }

            if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["hasreprint"].ToString()))
            {
                btnCancelVoidRequest.Enabled = false;
                btnVoidRequest.Enabled       = false;
                btnVoid.Enabled = false;
            }
        }