예제 #1
0
 private void LoadData()
 {
     try
     {
         if (dataGridView1.SelectedRows.Count > 0)
         {
             getDetails(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
             codex = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
             T_DIliveryHed cat = new T_DIliveryHed();
             cat.DoNo     = codex.Trim();
             cat.LocaCode = commonFunctions.GlobalLocation;
             cat          = new T_DIliveryHedDL().Selectt_DIliveryHed(cat, 2);
             GridPass();
             txt_DocNo.Text           = cat.DoNo;
             txt_Locacode.Text        = cat.LocaCode.Trim();
             txt_locationId_name.Text = findExisting.FindExisitingLoca(txt_Locacode.Text);
             txt_Customer.Text        = cat.Customer.Trim();
             txt_Customer_name.Text   = findExisting.FindExisitingCUstomer(txt_Customer.Text);
             txt_Lorry.Text           = cat.Lorry.Trim();
             txt_Lorry_name.Text      = findExisting.FindExisitingVehicle(txt_Lorry.Text);
             txt_Agent.Text           = cat.Agent.Trim();
             txt_Agent_name.Text      = findExisting.FindExisitingAgent(txt_Agent.Text);
             txt_InvNo.Text           = cat.InvNo.ToString();
             txt_InvoiceAmount.Text   = cat.InvoiceAmount.ToString();
             txt_Remarks.Text         = cat.Remarks;
         }
     }
     catch (Exception ex)
     {
         LogFile.WriteErrorLog(MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
     }
 }
        private void btn_hanoverdo_Click(object sender, EventArgs e)
        {
            //lbl_message.Text = "";
            errorProvider1.Clear();
            if (head.Handedover == 1)
            {
                errorProvider1.SetError(btn_hanoverdo, "This delivery order already handovered.".ToUpper());
                commonFunctions.SetMDIStatusMessage("This delivery order already handovered.", 1);
                return;
            }

            if (head.Dispatched == 0)
            {
                errorProvider1.SetError(btn_hanoverdo, "This delivery order is not dispatched.".ToUpper());
                commonFunctions.SetMDIStatusMessage("This delivery order is not dispatched.", 1);
                return;
            }

            //if (!M_VehicleDL.ExistingM_Vehicle(txt_Lorry.Text.Trim()))
            //{
            //    errorProvider1.SetError(txt_Lorry, "Vehicle details does not exists on the system ");
            //    commonFunctions.SetMDIStatusMessage("Vehicle details does not exists on the system ", 1);
            //    return;
            //}
            if (!M_AgentDL.ExistingM_Agent(txt_Agent.Text.Trim()))
            {
                errorProvider1.SetError(txt_Agent, "Agent does not exists on the system ");
                commonFunctions.SetMDIStatusMessage("Agent does not exists on the system ", 1);
                return;
            }

            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                T_DIliveryHedDL dl = new T_DIliveryHedDL();

                cat          = new T_DIliveryHed();
                cat.DoNo     = head.DONo.Trim();
                cat.LocaCode = commonFunctions.GlobalLocation;
                cat          = new T_DIliveryHedDL().Selectt_DIliveryHed(cat, 1);


                cat.Handovered     = 1;
                cat.HandoverDate   = DateTime.Now;
                cat.HandoverdUser  = commonFunctions.Loginuser;
                head.HandOverLorry = txt_Lorry.Text.Trim();

                head.Handedover     = 1;
                head.HandedoverDate = DateTime.Now;
                head.HandedoverUser = commonFunctions.Loginuser;


                if (dl.Savet_DIliveryHedSP(cat, 3) && new T_OrderTrackingDL().Savet_OrderTrackingSP(head, 3))
                {
                    commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                }
                getProcessedOFs();
            }
        }
예제 #3
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            try
            {
                if (codex.Trim() != "")
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Approve, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        T_DIliveryHed objt_trnsferNote = new T_DIliveryHed();
                        objt_trnsferNote.DoNo     = txt_DocNo.Text.Trim();
                        objt_trnsferNote.LocaCode = commonFunctions.GlobalLocation;
                        objt_trnsferNote          = new T_DIliveryHedDL().Selectt_DIliveryHed(objt_trnsferNote, 2);

                        objt_trnsferNote.Approved     = 1;
                        objt_trnsferNote.ApprovedDate = DateTime.Now;
                        objt_trnsferNote.ApprovedUser = commonFunctions.Loginuser;
                        new T_DIliveryHedDL().Savet_DIliveryHedSP(objt_trnsferNote, 3);

                        T_OrderTracking track = new T_OrderTracking();
                        track.DONo = txt_DocNo.Text.Trim();
                        //track.OFNo = txt_DocNo.Text.Trim();
                        track                = new T_OrderTrackingDL().Selectt_OrderTracking(track, xEnums.OrderTrackingTypes.DoNumber);
                        track.DOApproved     = 1;
                        track.DOApprovedUser = commonFunctions.Loginuser;
                        track.DOApprovedDate = DateTime.Now;
                        new T_OrderTrackingDL().Savet_OrderTrackingSP(track, 3);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);

                        getProcessedDOs();
                    }
                }
                else
                {
                    errorProvider1.SetError(dataGridView1, "Pelase select a delivery order from the list");
                    commonFunctions.SetMDIStatusMessage("Pelase select a delivery order from the list", 1);
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error when approving the delivery order", 1);
            }
        }
예제 #4
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            try
            {
                if (txt_aremarks.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_aremarks, "Audit remarks cannot be empty.");
                    commonFunctions.SetMDIStatusMessage("Audit remarks cannot be empty.", 1);
                    return;
                }

                if (codex.Trim() == "")
                {
                    errorProvider1.SetError(dataGridView1, "Pelase select a delivery order from the list");
                    commonFunctions.SetMDIStatusMessage("Pelase select a delivery order from the list", 1);
                    return;
                }

                if (!GridPass())
                {
                    errorProvider1.SetError(dataGridView2, "There is a variance in DO QTY and actual QTY");
                    commonFunctions.SetMDIStatusMessage("There is a variance in DO QTY and actual QTY", 1);
                    return;
                }
                if (!CartonChecking())
                {
                    errorProvider1.SetError(dataGridView2, "Invalied Carton details");
                    commonFunctions.SetMDIStatusMessage("Invalied Carton details", 1);
                    return;
                }
                if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Approve, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                {
                    T_DIliveryHed objt_trnsferNote = new T_DIliveryHed();
                    objt_trnsferNote.DoNo     = txt_DocNo.Text.Trim();
                    objt_trnsferNote.LocaCode = commonFunctions.GlobalLocation;
                    objt_trnsferNote          = new T_DIliveryHedDL().Selectt_DIliveryHed(objt_trnsferNote, 2);

                    objt_trnsferNote.AuditRemarks     = txt_aremarks.Text.Trim();
                    objt_trnsferNote.ReportedProblems = txt_repproblems.Text.Trim();
                    objt_trnsferNote.Audited          = 1;
                    objt_trnsferNote.AuditDate        = DateTime.Now;
                    objt_trnsferNote.AuditUser        = commonFunctions.Loginuser;
                    new T_DIliveryHedDL().Savet_DIliveryHedSP(objt_trnsferNote, 3);

                    T_OrderTracking track = new T_OrderTracking();
                    track.DONo      = txt_DocNo.Text.Trim();
                    track           = new T_OrderTrackingDL().Selectt_OrderTracking(track, xEnums.OrderTrackingTypes.DoNumber);
                    track.Audited   = 1;
                    track.AuditUser = commonFunctions.Loginuser;
                    track.AuditDate = DateTime.Now;
                    new T_OrderTrackingDL().Savet_OrderTrackingSP(track, 3);


                    foreach (DataGridViewRow drow in dataGridView2.Rows)
                    {
                        if (drow.Cells[0].Value.ToString().Trim() != null)
                        {
                            T_DiliveryDet det = new T_DiliveryDet();
                            det.DoNo          = txt_DocNo.Text.Trim();
                            det.Item          = drow.Cells[0].Value.ToString().Trim();
                            det               = new T_DiliveryDetDL().Selectt_DiliveryDet(det);
                            det.Carton        = commonFunctions.ToDecimal(drow.Cells[5].Value.ToString().Trim());
                            det.ActualCartons = commonFunctions.ToDecimal(drow.Cells[5].Value.ToString().Trim());
                            det.Remarks       = drow.Cells[7].Value.ToString().Trim();
                            det.Pass          = true;
                            new T_DiliveryDetDL().Savet_DiliveryDetSP(det, 3);
                        }
                    }
                    commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    getProcessedDOs();
                    getDetails("");
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error when approving the delivery order", 1);
            }
        }
예제 #5
0
        /// <summary>
        /// Saves a record to the T_DIliveryHed table.
        /// </summary>
        public Boolean Savet_DIliveryHedSP(T_DIliveryHed t_DIliveryHed, int formMode)
        {
            SqlCommand scom;
            bool       retvalue = false;

            try
            {
                scom             = new SqlCommand();
                scom.CommandType = CommandType.StoredProcedure;
                scom.CommandText = "T_DIliveryHedSave";

                scom.Parameters.Add("@DoNo", SqlDbType.VarChar, 20).Value            = t_DIliveryHed.DoNo;
                scom.Parameters.Add("@CompCode", SqlDbType.VarChar, 20).Value        = t_DIliveryHed.CompCode;
                scom.Parameters.Add("@LocaCode", SqlDbType.VarChar, 20).Value        = t_DIliveryHed.LocaCode;
                scom.Parameters.Add("@InvNo", SqlDbType.VarChar, 20).Value           = t_DIliveryHed.InvNo;
                scom.Parameters.Add("@InvoiceAmount", SqlDbType.Decimal, 9).Value    = t_DIliveryHed.InvoiceAmount;
                scom.Parameters.Add("@Customer", SqlDbType.VarChar, 20).Value        = t_DIliveryHed.Customer;
                scom.Parameters.Add("@CustomerDIscRate", SqlDbType.Decimal, 9).Value = t_DIliveryHed.CustomerDIscRate;
                scom.Parameters.Add("@Datex", SqlDbType.DateTime, 8).Value           = t_DIliveryHed.Datex;
                scom.Parameters.Add("@Agent", SqlDbType.VarChar, 20).Value           = t_DIliveryHed.Agent;
                scom.Parameters.Add("@Lorry", SqlDbType.VarChar, 20).Value           = t_DIliveryHed.Lorry;
                scom.Parameters.Add("@NoOfCartons", SqlDbType.Decimal, 9).Value      = t_DIliveryHed.NoOfCartons;
                scom.Parameters.Add("@Dispatched", SqlDbType.Int, 4).Value           = t_DIliveryHed.Dispatched;
                scom.Parameters.Add("@DispatchedDate", SqlDbType.DateTime, 8).Value  = t_DIliveryHed.DispatchedDate;
                scom.Parameters.Add("@DispatchedUser", SqlDbType.VarChar, 20).Value  = t_DIliveryHed.DispatchedUser;
                scom.Parameters.Add("@Checked", SqlDbType.Int, 4).Value                = t_DIliveryHed.Checked;
                scom.Parameters.Add("@CheckedUser", SqlDbType.VarChar, 20).Value       = t_DIliveryHed.CheckedUser;
                scom.Parameters.Add("@Checkeddate", SqlDbType.DateTime, 8).Value       = t_DIliveryHed.Checkeddate;
                scom.Parameters.Add("@Approved", SqlDbType.Int, 4).Value               = t_DIliveryHed.Approved;
                scom.Parameters.Add("@ApprovedUser", SqlDbType.VarChar, 20).Value      = t_DIliveryHed.ApprovedUser;
                scom.Parameters.Add("@ApprovedDate", SqlDbType.DateTime, 8).Value      = t_DIliveryHed.ApprovedDate;
                scom.Parameters.Add("@Handovered", SqlDbType.Int, 4).Value             = t_DIliveryHed.Handovered;
                scom.Parameters.Add("@HandoverdUser", SqlDbType.VarChar, 20).Value     = t_DIliveryHed.HandoverdUser;
                scom.Parameters.Add("@HandoverDate", SqlDbType.DateTime, 8).Value      = t_DIliveryHed.HandoverDate;
                scom.Parameters.Add("@HandoverCartons", SqlDbType.Decimal, 9).Value    = t_DIliveryHed.HandoverCartons;
                scom.Parameters.Add("@Delivered", SqlDbType.Int, 4).Value              = t_DIliveryHed.Delivered;
                scom.Parameters.Add("@DiliveredUser", SqlDbType.VarChar, 20).Value     = t_DIliveryHed.DiliveredUser;
                scom.Parameters.Add("@DiliveryDate", SqlDbType.DateTime, 8).Value      = t_DIliveryHed.DiliveryDate;
                scom.Parameters.Add("@Remarks", SqlDbType.VarChar, 150).Value          = t_DIliveryHed.Remarks;
                scom.Parameters.Add("@NoOfPrints", SqlDbType.Decimal, 9).Value         = t_DIliveryHed.NoOfPrints;
                scom.Parameters.Add("@PrintUser", SqlDbType.VarChar, 20).Value         = t_DIliveryHed.PrintUser;
                scom.Parameters.Add("@Status", SqlDbType.VarChar, 10).Value            = t_DIliveryHed.Status;
                scom.Parameters.Add("@Processed", SqlDbType.Int, 4).Value              = t_DIliveryHed.Processed;
                scom.Parameters.Add("@ProcessedDate", SqlDbType.DateTime, 8).Value     = t_DIliveryHed.ProcessedDate;
                scom.Parameters.Add("@ProcessedUser", SqlDbType.VarChar, 20).Value     = t_DIliveryHed.ProcessedUser;
                scom.Parameters.Add("@Audited", SqlDbType.Int, 4).Value                = t_DIliveryHed.Audited;
                scom.Parameters.Add("@AuditDate", SqlDbType.DateTime, 8).Value         = t_DIliveryHed.AuditDate;
                scom.Parameters.Add("@AuditUser", SqlDbType.VarChar, 20).Value         = t_DIliveryHed.AuditUser;
                scom.Parameters.Add("@Completed", SqlDbType.Int, 4).Value              = t_DIliveryHed.Completed;
                scom.Parameters.Add("@CompletedDate", SqlDbType.DateTime, 8).Value     = t_DIliveryHed.CompletedDate;
                scom.Parameters.Add("@PackingListCreated", SqlDbType.Int, 4).Value     = t_DIliveryHed.PackingListCreated;
                scom.Parameters.Add("@PackingListNo", SqlDbType.VarChar, 20).Value     = t_DIliveryHed.PackingListNo;
                scom.Parameters.Add("@PackingListDate", SqlDbType.DateTime, 8).Value   = t_DIliveryHed.PackingListDate;
                scom.Parameters.Add("@PackingListUser", SqlDbType.VarChar, 20).Value   = t_DIliveryHed.PackingListUser;
                scom.Parameters.Add("@ReportedProblems", SqlDbType.VarChar, 250).Value = t_DIliveryHed.ReportedProblems;
                scom.Parameters.Add("@AuditRemarks", SqlDbType.VarChar, 250).Value     = t_DIliveryHed.AuditRemarks;
                scom.Parameters.Add("@InsMode", SqlDbType.Int).Value  = formMode; // For insert
                scom.Parameters.Add("@RtnValue", SqlDbType.Int).Value = 0;


                u_DBConnection dbcon = new u_DBConnection();
                retvalue = dbcon.RunQuery(scom);
                return(retvalue);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
예제 #6
0
        public List <T_DIliveryHed> SelectT_DIliveryHedMulti(T_DIliveryHed objt_DIliveryHed2)
        {
            List <T_DIliveryHed> retval = new List <T_DIliveryHed>();

            try
            {
                strquery = @"select * from t_DIliveryHed where DoNo = '" + objt_DIliveryHed2.DoNo + "'";
                DataTable dtt_DIliveryHed = u_DBConnection.ReturnDataTable(strquery, CommandType.Text);
                foreach (DataRow drType in dtt_DIliveryHed.Rows)
                {
                    if (drType != null)
                    {
                        T_DIliveryHed objt_DIliveryHed = new T_DIliveryHed();
                        objt_DIliveryHed.DoNo               = drType["DoNo"].ToString();
                        objt_DIliveryHed.CompCode           = drType["CompCode"].ToString();
                        objt_DIliveryHed.LocaCode           = drType["LocaCode"].ToString();
                        objt_DIliveryHed.InvNo              = drType["InvNo"].ToString();
                        objt_DIliveryHed.InvoiceAmount      = decimal.Parse(drType["InvoiceAmount"].ToString());
                        objt_DIliveryHed.Customer           = drType["Customer"].ToString();
                        objt_DIliveryHed.CustomerDIscRate   = decimal.Parse(drType["CustomerDIscRate"].ToString());
                        objt_DIliveryHed.Datex              = DateTime.Parse(drType["Datex"].ToString());
                        objt_DIliveryHed.Agent              = drType["Agent"].ToString();
                        objt_DIliveryHed.Lorry              = drType["Lorry"].ToString();
                        objt_DIliveryHed.NoOfCartons        = decimal.Parse(drType["NoOfCartons"].ToString());
                        objt_DIliveryHed.Dispatched         = int.Parse(drType["Dispatched"].ToString());
                        objt_DIliveryHed.DispatchedDate     = DateTime.Parse(drType["DispatchedDate"].ToString());
                        objt_DIliveryHed.DispatchedUser     = drType["DispatchedUser"].ToString();
                        objt_DIliveryHed.Checked            = int.Parse(drType["Checked"].ToString());
                        objt_DIliveryHed.CheckedUser        = drType["CheckedUser"].ToString();
                        objt_DIliveryHed.Checkeddate        = DateTime.Parse(drType["Checkeddate"].ToString());
                        objt_DIliveryHed.Approved           = int.Parse(drType["Approved"].ToString());
                        objt_DIliveryHed.ApprovedUser       = drType["ApprovedUser"].ToString();
                        objt_DIliveryHed.ApprovedDate       = DateTime.Parse(drType["ApprovedDate"].ToString());
                        objt_DIliveryHed.Handovered         = int.Parse(drType["Handovered"].ToString());
                        objt_DIliveryHed.HandoverdUser      = drType["HandoverdUser"].ToString();
                        objt_DIliveryHed.HandoverDate       = DateTime.Parse(drType["HandoverDate"].ToString());
                        objt_DIliveryHed.HandoverCartons    = decimal.Parse(drType["HandoverCartons"].ToString());
                        objt_DIliveryHed.Delivered          = int.Parse(drType["Delivered"].ToString());
                        objt_DIliveryHed.DiliveredUser      = drType["DiliveredUser"].ToString();
                        objt_DIliveryHed.DiliveryDate       = DateTime.Parse(drType["DiliveryDate"].ToString());
                        objt_DIliveryHed.Remarks            = drType["Remarks"].ToString();
                        objt_DIliveryHed.NoOfPrints         = decimal.Parse(drType["NoOfPrints"].ToString());
                        objt_DIliveryHed.PrintUser          = drType["PrintUser"].ToString();
                        objt_DIliveryHed.Status             = drType["Status"].ToString();
                        objt_DIliveryHed.Processed          = int.Parse(drType["Processed"].ToString());
                        objt_DIliveryHed.ProcessedDate      = DateTime.Parse(drType["ProcessedDate"].ToString());
                        objt_DIliveryHed.ProcessedUser      = drType["ProcessedUser"].ToString();
                        objt_DIliveryHed.Audited            = int.Parse(drType["Audited"].ToString());
                        objt_DIliveryHed.AuditDate          = DateTime.Parse(drType["AuditDate"].ToString());
                        objt_DIliveryHed.AuditUser          = drType["AuditUser"].ToString();
                        objt_DIliveryHed.Completed          = int.Parse(drType["Completed"].ToString());
                        objt_DIliveryHed.CompletedDate      = DateTime.Parse(drType["CompletedDate"].ToString());
                        objt_DIliveryHed.PackingListCreated = int.Parse(drType["PackingListCreated"].ToString());
                        objt_DIliveryHed.PackingListNo      = drType["PackingListNo"].ToString();
                        objt_DIliveryHed.PackingListDate    = DateTime.Parse(drType["PackingListDate"].ToString());
                        objt_DIliveryHed.PackingListUser    = drType["PackingListUser"].ToString();
                        objt_DIliveryHed.ReportedProblems   = drType["ReportedProblems"].ToString();
                        objt_DIliveryHed.AuditRemarks       = drType["AuditRemarks"].ToString();
                        retval.Add(objt_DIliveryHed);
                    }
                }
                return(retval);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        public T_DIliveryHed Selectt_DIliveryHed(T_DIliveryHed objt_DIliveryHed, int isdispatched)
        {
            try
            {
                strquery = @"select * from t_DIliveryHed where DoNo = '" + objt_DIliveryHed.DoNo + "' and LocaCode = '" + objt_DIliveryHed.LocaCode.Trim() + "'";

                //if (isdispatched == 1)
                //{
                //    strquery = @"select * from t_DIliveryHed where DoNo = '" + objt_DIliveryHed.DoNo + "'";
                //}
                //else {
                //    strquery = @"select * from t_DIliveryHed where DoNo = '" + objt_DIliveryHed.DoNo + "' and Dispatched = 0";
                //}
                DataRow drType = u_DBConnection.ReturnDataRow(strquery);
                if (drType != null)
                {
                    objt_DIliveryHed.DoNo               = drType["DoNo"].ToString();
                    objt_DIliveryHed.CompCode           = drType["CompCode"].ToString();
                    objt_DIliveryHed.LocaCode           = drType["LocaCode"].ToString();
                    objt_DIliveryHed.InvNo              = drType["InvNo"].ToString();
                    objt_DIliveryHed.InvoiceAmount      = decimal.Parse(drType["InvoiceAmount"].ToString());
                    objt_DIliveryHed.Customer           = drType["Customer"].ToString();
                    objt_DIliveryHed.CustomerDIscRate   = decimal.Parse(drType["CustomerDIscRate"].ToString());
                    objt_DIliveryHed.Datex              = DateTime.Parse(drType["Datex"].ToString());
                    objt_DIliveryHed.Agent              = drType["Agent"].ToString();
                    objt_DIliveryHed.Lorry              = drType["Lorry"].ToString();
                    objt_DIliveryHed.NoOfCartons        = decimal.Parse(drType["NoOfCartons"].ToString());
                    objt_DIliveryHed.Dispatched         = int.Parse(drType["Dispatched"].ToString());
                    objt_DIliveryHed.DispatchedDate     = DateTime.Parse(drType["DispatchedDate"].ToString());
                    objt_DIliveryHed.DispatchedUser     = drType["DispatchedUser"].ToString();
                    objt_DIliveryHed.Checked            = int.Parse(drType["Checked"].ToString());
                    objt_DIliveryHed.CheckedUser        = drType["CheckedUser"].ToString();
                    objt_DIliveryHed.Checkeddate        = DateTime.Parse(drType["Checkeddate"].ToString());
                    objt_DIliveryHed.Approved           = int.Parse(drType["Approved"].ToString());
                    objt_DIliveryHed.ApprovedUser       = drType["ApprovedUser"].ToString();
                    objt_DIliveryHed.ApprovedDate       = DateTime.Parse(drType["ApprovedDate"].ToString());
                    objt_DIliveryHed.Handovered         = int.Parse(drType["Handovered"].ToString());
                    objt_DIliveryHed.HandoverdUser      = drType["HandoverdUser"].ToString();
                    objt_DIliveryHed.HandoverDate       = DateTime.Parse(drType["HandoverDate"].ToString());
                    objt_DIliveryHed.HandoverCartons    = decimal.Parse(drType["HandoverCartons"].ToString());
                    objt_DIliveryHed.Delivered          = int.Parse(drType["Delivered"].ToString());
                    objt_DIliveryHed.DiliveredUser      = drType["DiliveredUser"].ToString();
                    objt_DIliveryHed.DiliveryDate       = DateTime.Parse(drType["DiliveryDate"].ToString());
                    objt_DIliveryHed.Remarks            = drType["Remarks"].ToString();
                    objt_DIliveryHed.NoOfPrints         = decimal.Parse(drType["NoOfPrints"].ToString());
                    objt_DIliveryHed.PrintUser          = drType["PrintUser"].ToString();
                    objt_DIliveryHed.Status             = drType["Status"].ToString();
                    objt_DIliveryHed.Processed          = int.Parse(drType["Processed"].ToString());
                    objt_DIliveryHed.ProcessedDate      = DateTime.Parse(drType["ProcessedDate"].ToString());
                    objt_DIliveryHed.ProcessedUser      = drType["ProcessedUser"].ToString();
                    objt_DIliveryHed.Audited            = int.Parse(drType["Audited"].ToString());
                    objt_DIliveryHed.AuditDate          = DateTime.Parse(drType["AuditDate"].ToString());
                    objt_DIliveryHed.AuditUser          = drType["AuditUser"].ToString();
                    objt_DIliveryHed.Completed          = int.Parse(drType["Completed"].ToString());
                    objt_DIliveryHed.CompletedDate      = DateTime.Parse(drType["CompletedDate"].ToString());
                    objt_DIliveryHed.PackingListCreated = int.Parse(drType["PackingListCreated"].ToString());
                    objt_DIliveryHed.PackingListNo      = drType["PackingListNo"].ToString();
                    objt_DIliveryHed.PackingListDate    = DateTime.Parse(drType["PackingListDate"].ToString());
                    objt_DIliveryHed.PackingListUser    = drType["PackingListUser"].ToString();
                    objt_DIliveryHed.ReportedProblems   = drType["ReportedProblems"].ToString();
                    objt_DIliveryHed.AuditRemarks       = drType["AuditRemarks"].ToString();
                    return(objt_DIliveryHed);
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridView2.SelectedRows.Count > 0)
                {
                    codex     = dataGridView2.SelectedRows[0].Cells[0].Value.ToString();
                    head.OFNo = codex;
                    head      = new T_OrderTrackingDL().Selectt_OrderTracking(head, xEnums.OrderTrackingTypes.OrderNo);

                    if (head.DONo.Trim() != "")
                    {
                        cat          = new T_DIliveryHed();
                        cat.LocaCode = commonFunctions.GlobalLocation;
                        cat.DoNo     = head.DONo.Trim();
                        cat          = new T_DIliveryHedDL().Selectt_DIliveryHed(cat, 1);
                    }

                    //new T_DIliveryHedDL().Selectt_DIliveryHed(

                    if (head.OFApproved == 1)
                    {
                        colorswitchx(true, 0);
                    }
                    else
                    {
                        colorswitchx(false, 0);
                    }
                    if (head.InvCreated == 1)
                    {
                        colorswitchx(true, 1);
                    }
                    else
                    {
                        colorswitchx(false, 1);
                    }
                    if (head.InvApproved == 1)
                    {
                        colorswitchx(true, 2);
                    }
                    else
                    {
                        colorswitchx(false, 2);
                    }

                    if (head.DOCreated == 1)
                    {
                        colorswitchx(true, 3);
                    }
                    else
                    {
                        colorswitchx(false, 3);
                    }


                    if (head.DOApproved == 1)
                    {
                        colorswitchx(true, 4);
                    }
                    else
                    {
                        colorswitchx(false, 4);
                    }

                    if (head.Audited == 1)
                    {
                        colorswitchx(true, 5);
                    }
                    else
                    {
                        colorswitchx(false, 5);
                    }

                    if (head.PackingListCreated == 1)
                    {
                        colorswitchx(true, 6);
                    }
                    else
                    {
                        colorswitchx(false, 6);
                    }

                    if (head.Dispatched == 1)
                    {
                        colorswitchx(true, 7);
                    }
                    else
                    {
                        colorswitchx(false, 7);
                    }

                    if (head.Handedover == 1)
                    {
                        colorswitchx(true, 8);
                    }
                    else
                    {
                        colorswitchx(false, 8);
                    }


                    if (head.Completed == 1)
                    {
                        colorswitchx(true, 9);
                    }
                    else
                    {
                        colorswitchx(false, 9);
                    }
                    //if(head.OFApproved
                }
            }
            catch (Exception ex) { }
        }