示例#1
0
        private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            var pl = new PalletLocation();

            try
            {
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

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


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

            catch
            {
                gridDetails.DataSource  = null;
                gridShortage.DataSource = null;
            }
        }
示例#2
0
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();

            if (e != null && e.PrevFocusedRowHandle < -1)
            {
                return;
            }

            try
            {
                DataRow dr = gridReceiveView.GetFocusedDataRow();

                if (dr == null)
                {
                    return;
                }

                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                receiptDoc.LoadByPrimaryKey(ReceiptID);

                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();


                if (GRNFDetail.Rows.Count > 0)
                {
                    //var store = new Store();
                    //store.
                    BLL.PO order = new BLL.PO();
                    //var Mode = new Mode();
                    //Mode.LoadByPrimaryKey(order.ModeID);
                    //lblMode.Text = Mode.TypeName;
                    HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString();


                    lblRecieveStatus.Text     = dr["recieveStatus"].ToString();
                    lblReceiptNo.Text         = dr["ReceiptNo"].ToString();
                    lblRecievedBy.Text        = dr["ReceivedBy"].ToString();
                    lblRecievedDate.Text      = Convert.ToDateTime(dr["Date"]).ToShortDateString();
                    lblReciveType.Text        = (dr["ReceiveType"]).ToString();
                    lblWayBill.Text           = (dr["WayBillNo"]).ToString() != "" ? dr["WayBillNo"].ToString() : "-";
                    lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-";

                    var warehouse = new BLL.Warehouse();
                    warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID);
                    lblWarehouse.Text = warehouse.Name;
                    lblSupplier.Text  = dr["Supplier"].ToString();

                    var cluster = new BLL.Cluster();
                    cluster.LoadByPrimaryKey(warehouse.ClusterID);
                    lblCluster.Text = cluster.Name;



                    lblDocType.Text = "";

                    lblPoType.Text = dr["POType"].ToString();
                    //var ps = new BLL.PhysicalStore();
                    //ps.LoadByPrimaryKey(order.p);
                    //lblStore.Text = ps.Name;


                    txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"];
                    lblPoNumber.Text     = GRNFDetail.Rows[0]["PONumber"].ToString();

                    lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo;

                    lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo != ""?receiptDoc.InsurancePolicyNo : "-";

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"]));

                    txtActivity.EditValue = activity.FullActivityName;
                    lblActivity.Text      = activity.Name;

                    lblSubAccount.Text = activity.SubAccountName;
                    lblMode.Text       = activity.ModeName;
                    lblAccount.Text    = activity.AccountName;

                    gridDetails.DataSource = GRNFDetail;
                }

                if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID))
                {
                    gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                }
            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
        private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            var pl = new PalletLocation();
            try
            {
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

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

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

            catch
            {
                gridDetails.DataSource = null;
                gridShortage.DataSource = null;
            }
        }
        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;
            }
        }
示例#5
0
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();

            if (e != null && e.PrevFocusedRowHandle < -1)
            {
                return;
            }
            string warehouseName = string.Empty;

            try
            {
                var dr = gridReceiveView.GetFocusedDataRow();
                if (dr == null)
                {
                    return;
                }
                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                var receiptDoc = new BLL.Receipt();

                var receipt = new BLL.Receipt();
                receipt.LoadByPrimaryKey(ReceiptID);

                receiptDoc.LoadByPrimaryKey(ReceiptID);
                var GRNFDetail = receiptDoc.GetDetailsForGRNF();
                if (GRNFDetail.Rows.Count > 0)
                {
                    txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"];
                    lblPONo.Text         = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString());

                    lblCluster.Text        = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString();
                    txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString();

                    var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID);
                    txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo;
                    txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo;
                    txtTransfer.EditValue  = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo;
                    txtWayBill.EditValue   = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo;

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"]));
                    txtActivity.EditValue = activity.FullActivityName;

                    lblActivity.Text   = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name;
                    lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName;
                    lblAccount.Text    = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName;
                    lblMode.Text       = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName;

                    lblReceiveType.Text   = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString();
                    lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString();
                    lblDocumentType.Text  = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString();
                    lblPOType.Text        = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString();
                    lblPaymentType.Text   = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString();
                    lblReceiptNo.Text     = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString();

                    lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString();

                    var user = new User();
                    user.LoadByPrimaryKey(receiptDoc.SavedByUserID);
                    lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;

                    var receiveDoc = new ReceiveDoc();
                    receiveDoc.LoadByReceiptID(ReceiptID);
                    lblReceivedDate.Text  = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString();
                    lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString();

                    if (!receiveDoc.IsColumnNull("ConfirmedByUserID"))
                    {
                        user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID);
                        lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;
                    }
                    else
                    {
                        lblConfirmedBy.Text = "-";
                    }
                    var space  = string.Empty;
                    var length = warehouseName.Length;

                    HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo;
                }

                gridDetails.DataSource  = GRNFDetail;
                gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
示例#6
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;
            }
        }
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();
            if (e != null && e.PrevFocusedRowHandle < -1)
                return;

            try
            {
                DataRow dr = gridReceiveView.GetFocusedDataRow();

                if (dr == null)
                    return;

                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                receiptDoc.LoadByPrimaryKey(ReceiptID);

                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();

                if (GRNFDetail.Rows.Count > 0)
                {
                    //var store = new Store();
                    //store.
                    BLL.PO order = new BLL.PO();
                    //var Mode = new Mode();
                    //Mode.LoadByPrimaryKey(order.ModeID);
                    //lblMode.Text = Mode.TypeName;
                    HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString();

                    lblRecieveStatus.Text = dr["recieveStatus"].ToString();
                    lblReceiptNo.Text = dr["ReceiptNo"].ToString();
                    lblRecievedBy.Text = dr["ReceivedBy"].ToString();
                    lblRecievedDate.Text = Convert.ToDateTime(dr["Date"]).ToShortDateString();
                    lblReciveType.Text = (dr["ReceiveType"]).ToString();
                    lblWayBill.Text = (dr["WayBillNo"]).ToString()!="" ? dr["WayBillNo"].ToString() : "-";
                    lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-";

                    var warehouse = new BLL.Warehouse();
                    warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID);
                    lblWarehouse.Text = warehouse.Name;
                    lblSupplier.Text = dr["Supplier"].ToString();

                    var cluster = new BLL.Cluster();
                    cluster.LoadByPrimaryKey(warehouse.ClusterID);
                    lblCluster.Text = cluster.Name;

                    lblDocType.Text ="";

                    lblPoType.Text = dr["POType"].ToString();
                    //var ps = new BLL.PhysicalStore();
                    //ps.LoadByPrimaryKey(order.p);
                    //lblStore.Text = ps.Name;

                    txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"];
                    lblPoNumber.Text = GRNFDetail.Rows[0]["PONumber"].ToString();

                    lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo;

                    lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo!=""?receiptDoc.InsurancePolicyNo : "-";

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"]));

                    txtActivity.EditValue = activity.FullActivityName;
                    lblActivity.Text = activity.Name;

                    lblSubAccount.Text = activity.SubAccountName;
                    lblMode.Text = activity.ModeName;
                    lblAccount.Text = activity.AccountName;

                    gridDetails.DataSource = GRNFDetail;
                }

                if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID))
                {
                    gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                }

            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
               PalletLocation pl = new PalletLocation();
            if (e != null && e.PrevFocusedRowHandle < -1)
                return;
            string warehouseName = string.Empty;
            try
            {
                var dr = gridReceiveView.GetFocusedDataRow();
                if (dr == null)
                    return;
                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                var receiptDoc = new BLL.Receipt();

                var receipt = new BLL.Receipt();
                receipt.LoadByPrimaryKey(ReceiptID);

                receiptDoc.LoadByPrimaryKey(ReceiptID);
                var GRNFDetail = receiptDoc.GetDetailsForGRNF();
                if (GRNFDetail.Rows.Count > 0)
                {
                    txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"];
                    lblPONo.Text =  (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString());

                    lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString();
                    txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString();

                    var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID);
                    txtInvoiceNo.EditValue = lblInvoiceNo.Text =  String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo;
                    txtInsurance.EditValue = lblInsurancePolicy.Text =  String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo;
                    txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo;
                    txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo;

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"]));
                    txtActivity.EditValue = activity.FullActivityName;

                    lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name;
                    lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName;
                    lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName;
                    lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName;

                    lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString();
                    lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString();
                    lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString();
                    lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString();
                    lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString();
                    lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString();

                    lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString();

                    var user = new User();
                    user.LoadByPrimaryKey(receiptDoc.SavedByUserID);
                    lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;

                    var receiveDoc = new ReceiveDoc();
                    receiveDoc.LoadByReceiptID(ReceiptID);
                    lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString();
                    lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString();

                    if (!receiveDoc.IsColumnNull("ConfirmedByUserID"))
                    {
                        user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID);
                        lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName;
                    }
                    else
                    {
                        lblConfirmedBy.Text = "-";
                    }
                    var space = string.Empty;
                    var length = warehouseName.Length;

                    HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo;

                }

                gridDetails.DataSource = GRNFDetail;
                gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }