Example #1
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);
                BLL.Receipt receipt = new BLL.Receipt();
                string      s       = "";

                int length = ((string)SelectGRV["InvoiceNumber"]).Length;
                headerSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.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"];
                lblRecieptStatus.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"];
                lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString();
                lblInsurance.Text   = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"];
                //to handle STVNumber entry
                receipt.LoadByPrimaryKey(ReceiptID);
                NoSelection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                Selection.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutSTVNo.Enabled    = true;
                if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE)
                {
                    var newInvoiceNo = receipt.GetNewInvoiceNoForConvertedDeliveryNote();
                    txtSTVNo.EditValue     = newInvoiceNo != string.Empty ? newInvoiceNo : string.Empty;
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutSTVNo.Enabled    = false;
                }
                else
                {
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
            else
            {
                ResetForm();
            }
        }
        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);
                BLL.Receipt receipt = new BLL.Receipt();
                string s = "";

                int length = ((string) SelectGRV["InvoiceNumber"]).Length;
                headerSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.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"];
                lblRecieptStatus.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"];
                lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString();
                lblInsurance.Text = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"];
                //to handle STVNumber entry
                receipt.LoadByPrimaryKey(ReceiptID);
                NoSelection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                Selection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutSTVNo.Enabled = true;
                if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE)
                {
                    var newInvoiceNo = receipt.GetNewInvoiceNoForConvertedDeliveryNote();
                    txtSTVNo.EditValue = newInvoiceNo != string.Empty ? newInvoiceNo : string.Empty;
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutSTVNo.Enabled = false;
                }
                else
                {
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
            else
            {
                ResetForm();
            }
        }