Пример #1
0
 private void btnReport_Click(object sender, EventArgs e)
 {
     childReportViewer     = new ReportViewer("ALL", "ALL", dtpDate.Value.ToString("MMMyyyy"), 0);
     CommonData.ViewReport = "SSCRM_CHECKLIST";
     childReportViewer.Show();
 }
Пример #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int     i        = 0;
            ListBox ChkedRow = new ListBox();

            label1.Text   = "";
            lblQulf.Text  = "";
            lblEcode.Text = "";
            for (i = 0; i <= gvPendingData.RowCount - 1; i++)
            {
                if (Convert.ToBoolean(gvPendingData.Rows[i].Cells["chkApproved"].Value) == true)
                {
                    label1.Text   += gvPendingData.Rows[i].Cells["HAMH_APPL_NUMBER"].Value.ToString() + ",";
                    lblQulf.Text  += gvPendingData.Rows[i].Cells["Qualfication"].Value.ToString() + ",";
                    lblEcode.Text += gvPendingData.Rows[i].Cells["HAMH_EORA_CODE"].Value.ToString() + ",";
                }
            }
            foreach (DataGridViewRow row in gvPendingData.Rows)
            {
                if (row.Cells["aflag"].Value.ToString() == "YES")
                {
                    row.Cells[13].Value = false;
                }
            }
            if (label1.Text != "")
            {
                if (cmbStatus.SelectedIndex != 2)
                {
                    DialogResult dlgResult = MessageBox.Show("Do you want approved this records?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dlgResult == DialogResult.Yes)
                    {
                        try
                        {
                            objSQLDB = new SQLDB();
                            string[]  sValue    = label1.Text.TrimEnd(',').Split(',');
                            string[]  sQValue   = lblQulf.Text.TrimEnd(',').Split(',');
                            string[]  sEValue   = lblEcode.Text.TrimEnd(',').Split(',');
                            string    SqlUpdate = "";
                            DataTable dtMaxApr  = objSQLDB.ExecuteDataSet("SELECT  MAX(isnull(HAMH_APPROVAL_NO,0))+1 AS HAMH_APPROVAL_NO FROM HR_APPL_MASTER_HEAD", CommandType.Text).Tables[0];
                            int       iMaxApr   = Convert.ToInt32(dtMaxApr.Rows[0][0]);
                            for (int j = 0; j < sValue.Length; j++)
                            {
                                if (sQValue[j].Trim().ToString() != "")
                                {
                                    SqlUpdate += " UPDATE HR_APPL_MASTER_HEAD SET HAMH_APPROVAL_NO=" + iMaxApr +
                                                 ",HAMH_WORKING_STATUS='W',HAMH_APPROVAL_DATE='" + Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MMM/yyyy") +
                                                 "',HAMH_MODIFIED_BY='" + CommonData.LogUserId + "',HAMH_MODIFIED_DATE='" + Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MMM/yyyy") +
                                                 "' WHERE HAMH_APPL_NUMBER=" + sValue[j];
                                    //SqlUpdate += " update eora_master set edu_qualification=(select top 1 haed_examination_passed from dbo.HR_APPL_EDU_DETL where " +
                                    //    " haed_appl_number=a.HAMH_APPL_NUMBER order by haed_appl_sl_number desc)From HR_APPL_MASTER_HEAD a inner join eora_master b " +
                                    //    " on a.hamh_eora_code=b.ecode where HAMH_APPL_NUMBER=" + sValue[j] + ";";
                                    SqlUpdate += " update eora_master set edu_qualification='" + sQValue[j] + "' where ecode=" + sEValue[j] + ";";
                                    SqlUpdate += " INSERT into hr_appl_approval_history" +
                                                 "(haah_approval_no" +
                                                 ", haah_eora_code" +
                                                 ", haah_appl_no" +
                                                 ", haah_approval_date" +
                                                 ", haah_approval_by" +
                                                 ", haah_branch_code)" +
                                                 " Values(" +
                                                 "" + iMaxApr +
                                                 "," + sEValue[j] +
                                                 "," + sValue[j] +
                                                 ",getdate(),'" + CommonData.LogUserId +
                                                 "','" + cmbBranch_optional.SelectedValue.ToString() + "')";
                                }
                            }
                            int iretuval = objSQLDB.ExecuteSaveData(SqlUpdate);
                            //This is for Sending mail.
                            if (iretuval > 0)
                            {
                                DataSet dsBrnchEmail = objSQLDB.ExecuteDataSet("SELECT BRANCH_MAIL_ID" +
                                                                               ",BM_HR_EMAIL" +
                                                                               ",BM_REG_HR_MAIL" +
                                                                               ",BM_TRAINER_MAIL" +
                                                                               ",BM_INCH_MAIL" +
                                                                               " FROM BRANCH_MAS WHERE BRANCH_CODE='" + cmbBranch_optional.SelectedValue + "'");
                                if (dsBrnchEmail.Tables[0].Rows[0][0].ToString() != "")
                                {
                                    DataTable dtMailData = objSQLDB.ExecuteDataSet("SELECT ecode,member_name,father_name,emp_doj,emp_dob,DATEDIFF(YEAR, emp_dob, GETDATE()) Age,desig,edu_qualification " +
                                                                                   "FROM HR_APPL_MASTER_HEAD a inner join eora_master b on a.hamh_eora_code=b.ecode " +
                                                                                   "WHERE HAMH_APPL_NUMBER IN(" + label1.Text.TrimEnd(',') + ") ORDER BY DATEDIFF(YEAR, emp_dob, GETDATE()) DESC", CommandType.Text).Tables[0];

                                    string Mailbody = "<br /><br /><table padding='0' font-family= 'Segoe UI' cellpadding='5' cellspacing='0' border='1'>";
                                    Mailbody += "<tr><td colspan=\"9\"><a href=\"www.shivashakthigroup.com\">" +
                                                "<img src=\"http://shivashakthigroup.com/wp-content/uploads/2013/01/logo.png\" alt=\"Shivashakthi Group of Companies\"/></a></td></tr>";
                                    Mailbody += "<tr style =\"background-color:#6FA1D2; color:#ffffff;\"><td>SlNo</td><td>ECode</td><td>Employee Name</td><td>Father Name</td><td>DOJ</td>" +
                                                "<td>DOB</td><td>Age</td><td>Desig</td><td>Qualification</td></tr>";
                                    int j = 1;
                                    foreach (DataRow dr in dtMailData.Rows)
                                    {
                                        Mailbody += "<tr><td>" + j.ToString() + "</td>" +
                                                    "<td>" + dr["ecode"].ToString() + "</td>" +
                                                    "<td>" + dr["member_name"].ToString().ToUpper() + "</td>" +
                                                    "<td>" + dr["father_name"].ToString().ToUpper() + "</td>" +
                                                    "<td>" + Convert.ToDateTime(dr["emp_doj"]).ToString("dd/MMM/yyyy").ToUpper() + "</td>" +
                                                    "<td>" + Convert.ToDateTime(dr["emp_dob"]).ToString("dd/MMM/yyyy").ToUpper() + "</td>" +
                                                    "<td>" + dr["Age"].ToString().ToUpper() + "</td>" +
                                                    "<td>" + dr["desig"].ToString().ToUpper() + "</td>" +
                                                    "<td>" + dr["edu_qualification"].ToString().ToUpper() + "</td></tr>";
                                        j++;
                                    }
                                    Mailbody += "</table>";
                                    SendMail(dsBrnchEmail.Tables[0], iMaxApr, Mailbody);
                                }
                            }
                            MessageBox.Show("The records approved successfully", "SSCRM Application", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            objSQLDB = null;
                            GetPendingData();
                            ReportViewer childForm = new ReportViewer(iMaxApr);
                            CommonData.ViewReport = "ApprovedDetails";
                            childForm.Show();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "SSCRM", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    DialogResult dlgResult = MessageBox.Show("Do you want approved for left this records?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dlgResult == DialogResult.Yes)
                    {
                        objSQLDB = new SQLDB();
                        string LoginID   = objSQLDB.ExecuteDataSet("SELECT UM_ECODE FROM USER_MASTER WHERE UM_USER_ID='" + CommonData.LogUserId + "'").Tables[0].Rows[0][0].ToString();
                        string SqlUpdate = " UPDATE HR_APPL_MASTER_HEAD SET HAMH_LEFT_APPROVAL_FLAG='YES',HAMH_WORKING_STATUS='L',HAMH_LEFT_APPROVAL_ECODE='" + LoginID + "' WHERE HAMH_APPL_NUMBER in(" + label1.Text.TrimEnd(',') + ") AND HAMH_COMPANY_CODE='" + cmbCompany.SelectedValue + "' AND HAMH_BRANCH_CODE='" + cmbBranch_optional.SelectedValue + "'";
                        int    iretuval  = objSQLDB.ExecuteSaveData(SqlUpdate);
                        MessageBox.Show("The records left approved successfully", "SSCRM Application", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        objSQLDB = null;
                        GetPendingData();
                    }
                }
            }
            else
            {
                MessageBox.Show("Select atleast one checkbox", "SSCRM Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private void gvPromotiomDetl_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (e.ColumnIndex > -1)
                {
                    GetEmpSalDetails(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString());
                    if (e.ColumnIndex == gvPromotiomDetl.Columns["Select"].Index)
                    {
                        bool cbchecked = (bool)gvPromotiomDetl.Rows[e.RowIndex].Cells["Select"].EditedFormattedValue;
                        if (cbchecked == true)
                        {
                            gvPromotiomDetl.Rows[e.RowIndex].Cells["Appr"].Value = "YES";
                            //DataGridViewImageColumn tempCell = new DataGridViewImageColumn();
                            //tempCell.Image = Properties.Resources.actions_edit;
                            //gvPromotiomDetl.Rows[e.RowIndex].Cells["Sel"].Value = Properties.Resources.actions_edit;
                            GetEmpSalDetails(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString());
                        }
                        else
                        {
                            gvPromotiomDetl.Rows[e.RowIndex].Cells["Appr"].Value = "NO";
                            //DataGridViewImageColumn tempCell = new DataGridViewImageColumn();
                            //tempCell.Image = Properties.Resources.actions_delete;
                            //gvPromotiomDetl.Rows[e.RowIndex].Cells["Sel"].Value = Properties.Resources.actions_delete;
                            txtRefNo.Text        = meWef.Text = txtDept.Text = txtDesig.Text = txtComp.Text = txtBranch.Text = txtRemarks.Text = "";
                            txtReportToName.Text = txtReportingBranch.Text = txtSalGross.Text = txtSalBasic.Text = txtSalHRA.Text = txtSalCCA.Text = "";
                            txtSalConvAllw.Text  = txtSalLTAAllw.Text = txtSalSpecialAllw.Text = txtSalUniformAllw.Text = txtVehicleAllw.Text = "";
                            txtSalChildAllw.Text = txtSalBNPAllw.Text = txtSalMedAllw.Text = txtSalPetrAllw.Text = txtPromType.Text = "";
                        }
                    }
                    else if (e.ColumnIndex == gvPromotiomDetl.Columns["Print"].Index)
                    {
                        try
                        {
                            GetEmpSalDetails(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString());
                            string strCmd = " SELECT HLPH_LETTER_REF_NO,HLPH_APPL_NO FROM " +
                                            "HR_PB_LETTER_PRINT_HIST " +
                                            " WHERE HLPH_APPL_NO=" + Convert.ToInt32(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString()) +
                                            " AND HLPH_LETTER_REF_NO='" + txtRefNo.Text +
                                            "'";
                            objDB = new SQLDB();
                            DataTable dt = objDB.ExecuteDataSet(strCmd).Tables[0];
                            if (dt.Rows.Count == 0)
                            {
                                //INC
                                //PRM
                                //PRM&INC
                                //REDSG
                                //TRN
                                //TRN&INC
                                //TRN&INC&PRM
                                //TRN&PRM

                                if (cmbPBType.SelectedValue.ToString() == "TRN")
                                {
                                    ReportViewer cldReportViewer = new ReportViewer("", "", gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["ProductID"].Value.ToString(), "TRN");
                                    CommonData.ViewReport = "PROMOTION_BOARD_TRN_LETTER";
                                    cldReportViewer.Show();
                                }
                                else if (cmbPBType.SelectedValue.ToString() == "INC" ||
                                         cmbPBType.SelectedValue.ToString() == "PRM" ||
                                         cmbPBType.SelectedValue.ToString() == "PRM&INC" ||
                                         cmbPBType.SelectedValue.ToString() == "REDSG" ||
                                         cmbPBType.SelectedValue.ToString() == "TRN&INC" ||
                                         cmbPBType.SelectedValue.ToString() == "TRN&INC&PRM" ||
                                         cmbPBType.SelectedValue.ToString() == "TRN&PRM")
                                {
                                }
                                else
                                {
                                    CommonData.ViewReport = "PRINT_SALES_APPT_LETTER";
                                    ReportViewer childReportViewer = new ReportViewer(Convert.ToInt32(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value).ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["ProductID"].Value.ToString());
                                    childReportViewer.Show();
                                }

                                string strInsert = "INSERT INTO HR_PB_LETTER_PRINT_HIST(HLPH_APPL_NO " +
                                                   ", HLPH_PB_TYPE " +
                                                   ", HLPH_LETTER_REF_NO " +
                                                   ", HLPH_PRINT_DATE " +
                                                   ")VALUES" +
                                                   "(" + Convert.ToInt32(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString()) +
                                                   ",'" + cmbPBType.SelectedValue.ToString() + "','" + txtRefNo.Text +
                                                   "',getdate())";

                                if (strInsert.Length > 10)
                                {
                                    int iRes = objDB.ExecuteSaveData(strInsert);
                                }
                            }

                            else
                            {
                                MessageBox.Show("Letter Already Printed", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }
                    else if (e.ColumnIndex == gvPromotiomDetl.Columns["Edit"].Index && iFormType != 1)
                    {
                        objPromotionBoard = new PromotionBoard(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString());
                        objPromotionBoard.objPromotionBoardApproval = this;
                        objPromotionBoard.ShowDialog();
                    }
                    else if (e.ColumnIndex == gvPromotiomDetl.Columns["Delete"].Index)
                    {
                        if (iFormType != 1)
                        {
                            DeletePromotionBoardData(gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString());
                        }//gvPromotiomDetl.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString();
                         //gvPromotiomDetl.Rows[e.RowIndex].Cells["TrnNo"].Value.ToString();
                    }
                }
            }
        }
 private void btnReport_Click(object sender, EventArgs e)
 {
     if (CheckData())
     {
         if (strRep == "STOCKPOINT_DC")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCKPOINT_DC";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "");
             objReportview.Show();
         }
         else if (strRep == "SP_PENDING_DC")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCKPOINT_DC";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "PENDING");
             objReportview.Show();
         }
         else if (strRep == "STOCKPOINT_DCST")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCKPOINT_DCST";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"));
             objReportview.Show();
         }
         else if (strRep == "STOCKPOINT_GRN")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCKPOINT_GRN";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"));
             objReportview.Show();
         }
         else if (strRep == "STOCK_REC")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "SP_STOCK_RECONSILATION";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], "SUMMARY");
             objReportview.Show();
         }
         else if (strRep == "STOCKPOINT_RECONSILATION")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCKPOINT_STOCK_RECONSILATION";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"));
             objReportview.Show();
         }
         else if (strRep == "VEHICLE_LOAN")
         {
             string   strBranchCode = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     strBranchCode += arrBranch[0];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "VEHICLE_LOAN_RECOVERY_SUMMARY";
             ReportViewer objReportview = new ReportViewer(strBranchCode, strBranchCode, CommonData.FinancialYear);
             objReportview.Show();
         }
         else if (strRep == "VEHICLE_INFO")
         {
             string   strBranchCode = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     strBranchCode += arrBranch[0];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "VEHICLE_INFORMATION";
             ReportViewer objReportview = new ReportViewer(strBranchCode, strBranchCode, CommonData.FinancialYear);
             objReportview.Show();
         }
         else if (strRep == "SaleSummaryBulletin")
         {
             string   strBranchCode = "";
             string   strCompCode   = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                         strCompCode   += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompCode   += arrBranch[1];
                 }
                 arrBranch = null;
             }
             objDB = new SQLDB();
             string sqlText = " EXEC Process_SalesBulletinSummary '" + strCompCode + "','" + strBranchCode + "','" + Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy").ToUpper() + "',''";
             try
             {
                 objDB.ExecuteSaveData(sqlText);
                 MessageBox.Show("Process Completed", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
             finally
             {
                 objDB = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             //CommonData.ViewReport = "VEHICLE_INFORMATION";
             //ReportViewer objReportview = new ReportViewer(strBranchCode, strBranchCode, CommonData.FinancialYear);
             //objReportview.Show();
         }
         else if (strRep == "STOCK_SUMMARY")
         {
             string   strBranchCode = "";
             string   strCompany    = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     if (strCompany != "")
                     {
                         strCompany += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompany    += arrBranch[1];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCK_POINT_STOCK_SUMMARY";
             ReportViewer objReportview = new ReportViewer(strCompany, strBranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "SUMMARY");
             objReportview.Show();
         }
         else if (strRep == "STOCK_LEDGER")
         {
             string   strBranchCode = "";
             string   strCompany    = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     if (strCompany != "")
                     {
                         strCompany += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompany    += arrBranch[1];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "STOCK_POINT_STOCK_LEDGER";
             ReportViewer objReportview = new ReportViewer(strCompany, strBranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "LEDGER");
             objReportview.Show();
         }
         else if (strRep == "SALES_STAFF_ALL")
         {
             string[] strBranchCode;
             strBranchCode         = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "BRANCH_WISE_SALES_STAFF_ALL";
             ReportViewer objReportview = new ReportViewer(strBranchCode[1], strBranchCode[0], "SALES_STAFF_ALL");
             objReportview.Show();
         }
         else if (strRep == "IT_SYS_INV_CPU")
         {
             string   strBranchCode = "";
             string   strCompany    = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     if (strCompany != "")
                     {
                         strCompany += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompany    += arrBranch[1];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "IT_SYS_INV_CPU";
             ReportViewer objReportview = new ReportViewer(strCompany, strBranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "DETAILED");
             objReportview.Show();
         }
         else if (strRep == "EMP_CONTACT_DETAILS")
         {
             string   strBranchCode = "";
             string   strCompany    = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     if (strCompany != "")
                     {
                         strCompany += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompany    += arrBranch[1];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "SSCRM_HR_REP_EMP_CONTACT_DETAILS";
             ReportViewer objReportview = new ReportViewer(strCompany, strBranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), "DETAILED");
             objReportview.Show();
         }
         else if (strRep == "SERVICE_CONSOLIDATION")
         {
             string   strBranchCode = "";
             string   strCompany    = "";
             string[] arrBranch;
             for (int i = 0; i < clbGLList.Items.Count; i++)
             {
                 if (clbGLList.GetItemCheckState(i) == CheckState.Checked)
                 {
                     //arrBranch = clbGLList.Items[i].Tag.ToString().Split('@');
                     arrBranch = ((SSAdmin.NewCheckboxListItem)(clbGLList.Items[i])).Tag.ToString().Split('@');
                     if (strBranchCode != "")
                     {
                         strBranchCode += ",";
                     }
                     if (strCompany != "")
                     {
                         strCompany += ",";
                     }
                     strBranchCode += arrBranch[0];
                     strCompany    += arrBranch[1];
                 }
                 arrBranch = null;
             }
             //strBranchCode = ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString().Split('@');
             CommonData.ViewReport = "SSCRM_REP_SERVICE_MON_CUMULATIVE";
             ReportViewer objReportview = new ReportViewer(strCompany, strBranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy").ToUpper(), "ALL");
             objReportview.Show();
         }
         else
         {
             childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpDate.Value).ToString("MMMyyyy"), ((SSAdmin.NewCheckboxListItem)(clbGLList.SelectedItem)).Tag.ToString());
             CommonData.ViewReport = "GC_GL_WISE_PRODUCT_RECONSILATION";
             childReportViewer.Show();
         }
     }
 }
        private void btnReport_Click(object sender, EventArgs e)
        {
            if (Rep_type == "RECR_SUMMARY")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy"), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy"), "SUMMARY");
                CommonData.ViewReport = "RECRUITEMENT_DATA_SUMMARY";
                childReportViewer.Show();
            }
            else if (Rep_type == "RECR_SUMMARY_BY_COMPANY")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy"), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy"), "SUMMARY");
                CommonData.ViewReport = "RECRUITEMENT_SUMMARY_BY_COMPANY";
                childReportViewer.Show();
            }
            else if (Rep_type == "FOUNDATION_EYE_CAMP_REG")
            {
                childReportViewer     = new ReportViewer(Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy"), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy"));
                CommonData.ViewReport = "FOUNDATION_EYE_CAMP_REG";
                childReportViewer.Show();
            }
            else if (Rep_type == "SSERP_REP_STATIONARY_GRN_REGISTER")
            {
                childReportViewer     = new ReportViewer("", "", Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy").ToUpper(), "");
                CommonData.ViewReport = "SSERP_REP_STATIONARY_GRN_REGISTER";
                childReportViewer.Show();
            }
            else if (Rep_type == "SSERP_REP_STATIONARY_DELIVERY_CHALLAN_REGISTER")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy").ToUpper(), "");
                CommonData.ViewReport = "SSERP_REP_STATIONARY_DELIVERY_CHALLAN_REGISTER";
                childReportViewer.Show();
            }

            else if (Rep_type == "PENDING KNOCKING REGISTER")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy").ToUpper(), "PENDING");
                CommonData.ViewReport = "PENDING KNOCKING REGISTER";
                childReportViewer.Show();
            }
            else if (Rep_type == "SSCRM_REP_STATIONARY_SHORTAGE_REGISTER")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, CommonData.FinancialYear, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy").ToUpper(), "");
                CommonData.ViewReport = "SSCRM_REP_STATIONARY_SHORTAGE_REGISTER";
                childReportViewer.Show();
            }
            else if (Rep_type == "SSCRM_REP_STATIONARY_RECONSILATION_STORE")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("dd/MMM/yyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy").ToUpper(), "");
                CommonData.ViewReport = "SSCRM_REP_STATIONARY_RECONSILATION_STORE";
                childReportViewer.Show();
            }

            else if (Rep_type == "SSCRM_REP_GL_WISE_STOCK_RECONCILLATION")
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("MMMyyyy").ToUpper(), Convert.ToDateTime(dtpTDate.Value).ToString("MMMyyyy").ToUpper(), "");
                CommonData.ViewReport = "SSCRM_REP_GL_WISE_STOCK_RECONCILLATION";
                childReportViewer.Show();
            }


            else
            {
                childReportViewer     = new ReportViewer(CommonData.CompanyCode, CommonData.BranchCode, Convert.ToDateTime(dtpFDate.Value).ToString("yyyy-MM-dd"), Convert.ToDateTime(dtpTDate.Value).ToString("dd/MMM/yyyy"), "RECRUITEMENT_DATA");
                CommonData.ViewReport = "RECRUITEMENT_DATA";
                childReportViewer.Show();
            }
        }
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (txtEoraCode_num.Text.ToString().Trim().Length > 4)
     {
         if (iFormType == 0)
         {
             try
             {
                 objDB = new SQLDB();
                 string sqlText    = "";
                 int    approvalno = 0;
                 sqlText    = "SELECT isnull(HAMH_APPROVAL_NO,0) FROM HR_APPL_MASTER_HEAD WHERE HAMH_EORA_CODE = '" + txtEoraCode_num.Text + "'";
                 approvalno = Convert.ToInt32(objDB.ExecuteDataSet(sqlText).Tables[0].Rows[0][0].ToString());
                 if (approvalno > 0)
                 {
                     ReportViewer childForm = new ReportViewer(approvalno);
                     CommonData.ViewReport = "ApprovedDetails";
                     childForm.Show();
                 }
                 else
                 {
                     MessageBox.Show("No Approval Letter Found With " + approvalno, "SSCRM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
         else if (iFormType == 1)
         {
             try
             {
                 objDB = new SQLDB();
                 string sqlText    = "";
                 int    approvalno = 0;
                 sqlText    = "SELECT isnull(HAMH_APPL_NUMBER,0) FROM HR_APPL_MASTER_HEAD WHERE HAMH_EORA_CODE = '" + txtEoraCode_num.Text + "'";
                 approvalno = Convert.ToInt32(objDB.ExecuteDataSet(sqlText).Tables[0].Rows[0][0].ToString());
                 if (approvalno > 0)
                 {
                     ReportViewer childForm = new ReportViewer(approvalno);
                     CommonData.ViewReport = "Employee_Salary_Structure_Details";
                     childForm.Show();
                 }
                 else
                 {
                     MessageBox.Show("Salary Structure Not Found" + approvalno, "SSCRM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
         else if (iFormType == 2)
         {
             try
             {
                 //if (cbReportType.SelectedItem.ToString() == "COFF")
                 //{
                 //    ReportViewer childForm = new ReportViewer(Convert.ToInt32(txtEoraCode_num.Text));
                 //    CommonData.ViewReport = "SSCRM_REP_COFF";
                 //    childForm.Show();
                 //}
                 //else
                 //{
                 ReportViewer childForm = new ReportViewer(Convert.ToInt32(txtEoraCode_num.Text), cbReportType.SelectedItem.ToString());
                 CommonData.ViewReport = "SSCRM_REP_EMP_LEAVE_DETAILS";
                 childForm.Show();
                 //}
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
     }
     else
     {
         MessageBox.Show("Incorrect Agent Code", "SSCRM", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        private void btnReport_Click(object sender, EventArgs e)
        {
            if (checkdata() == true)
            {
                Int32 frmQty = 0, ToQty = 0;

                GetSelectedValues();
                GetSelectedTeakQtyDetails();
                if (dFrmQty != 0 || dToQty != 0)
                {
                }
                else
                {
                    dFrmQty = 0;
                    dToQty  = 99999;
                }
                if (strStatus.Length == 0)
                {
                    strStatus = "COMPLETED,PENDING ACTIVITY";
                }

                frmQty = Convert.ToInt32(dFrmQty);
                ToQty  = Convert.ToInt32(dToQty);

                if (cbReportType.SelectedIndex == 0)
                {
                    CommonData.ViewReport = "SERVICES_ACTIVITY_STATUS_LIST";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "", "", "", cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "ALL");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 1)
                {
                    CommonData.ViewReport = "DISTRICT_WISE_SERVICES_ACTIVITY_STATUS_LIST";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, sDistrict, "", "ALL", cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "DISTRICT_WISE");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 2)
                {
                    CommonData.ViewReport = "VILLAGE_WISE_SERVICES_ACTIVITY_STATUS_LIST";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "ALL", "", sVillage, cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "VILLAGE_WISE");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 3)
                {
                    CommonData.ViewReport = "SERVICES_ACTIVITIES_SUMMARY";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "ALL", "", "ALL", cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "ALL");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 4)
                {
                    CommonData.ViewReport = "DISTRICT_WISE_SERVICES_ACTIVITIES_SUMMARY";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, sDistrict, "", "ALL", cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "DISTRICT_WISE");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 5)
                {
                    CommonData.ViewReport = "VILLAGE_WISE_SERVICES_ACTIVITIES_SUMMARY";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "ALL", "", sVillage, cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "VILLAGE_WISE");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 6)
                {
                    CommonData.ViewReport = "CAMP_WISE_SERVICE_ACTIVITIES_LIST";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "ALL", sCamps, sVillage, cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "CAMP_WISE");
                    childReportViewer.Show();
                }
                else if (cbReportType.SelectedIndex == 7)
                {
                    CommonData.ViewReport = "CAMP_WISE_SERVICE_ACTIVITY_SUMMARY";
                    childReportViewer     = new ReportViewer(Company, Branches, DocumentMonth, "ALL", sCamps, sVillage, cbProdType.Text.ToString(), sActivity, strStatus, Convert.ToString(frmQty), Convert.ToString(ToQty), "CAMP_WISE");
                    childReportViewer.Show();
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sqlText = "";
            int    iMax    = 0;

            if (isUpDate == false)
            {
                txtRefNo.Text = GenNewRefNo(cmbCompany.SelectedValue.ToString(), cmbBranch.SelectedValue.ToString(), CommonData.FinancialYear, cmbPBType.SelectedValue.ToString());
            }
            objDB = new SQLDB();

            int iRes = 0;

            if (CheckData())
            {
                string[] sDesg = cmbDesignation.SelectedValue.ToString().Split('@');
                Int32    iBasic, iHra, iCca, iConv, iLta, iSpec, iUnif, iVeh, iChild, iBnp, iMed, iPet, iGross;
                iBasic = iHra = iCca = iConv = iLta = iSpec = iUnif = iVeh = iChild = iBnp = iMed = iPet = iGross = 0;
                if (txtSalBasic.Text.Length > 0)
                {
                    iBasic = Convert.ToInt32(txtSalBasic.Text);
                }
                if (txtSalHRA.Text.Length > 0)
                {
                    iHra = Convert.ToInt32(txtSalHRA.Text);
                }
                if (txtSalCCA.Text.Length > 0)
                {
                    iCca = Convert.ToInt32(txtSalCCA.Text);
                }
                if (txtSalConvAllw.Text.Length > 0)
                {
                    iConv = Convert.ToInt32(txtSalConvAllw.Text);
                }
                if (txtSalLTAAllw.Text.Length > 0)
                {
                    iLta = Convert.ToInt32(txtSalLTAAllw.Text);
                }
                if (txtSalSpecialAllw.Text.Length > 0)
                {
                    iSpec = Convert.ToInt32(txtSalSpecialAllw.Text);
                }
                if (txtSalUniformAllw.Text.Length > 0)
                {
                    iUnif = Convert.ToInt32(txtSalUniformAllw.Text);
                }
                if (txtVehicleAllw.Text.Length > 0)
                {
                    iVeh = Convert.ToInt32(txtVehicleAllw.Text);
                }
                if (txtSalChildAllw.Text.Length > 0)
                {
                    iChild = Convert.ToInt32(txtSalChildAllw.Text);
                }
                if (txtSalBNPAllw.Text.Length > 0)
                {
                    iBnp = Convert.ToInt32(txtSalBNPAllw.Text);
                }
                if (txtSalMedAllw.Text.Length > 0)
                {
                    iMed = Convert.ToInt32(txtSalMedAllw.Text);
                }
                if (txtSalPetrAllw.Text.Length > 0)
                {
                    iPet = Convert.ToInt32(txtSalPetrAllw.Text);
                }
                iGross = iBasic + iHra + iCca + iConv + iLta + iSpec + iUnif + iVeh + iChild + iBnp + iMed + iPet;
                try
                {
                    iMax = Convert.ToInt32(objDB.ExecuteDataSet("select IsNull(Max(HESS_TRXN_NO),0)+1 from HR_EMP_SAL_STRU").Tables[0].Rows[0][0]);
                    if (isUpDate == false && iMax > 0)
                    {
                        sqlText = "INSERT INTO HR_EMP_SAL_STRU(HESS_FROM_COMPANY_CODE,HESS_FROM_BRANCH_CODE,HESS_TO_COMPANY_CODE,HESS_TO_BRANCH_CODE,HESS_APPL_NUMBER" +
                                  ",HESS_EORA_CODE,HESS_PROMOTION_CATEGORY_CODE,HESS_TRXN_NO,HESS_TRXN_DATE,HESS_SALSTRU_TYPE,HESS_SALSTRU_CODE,HESS_LTR_REF_NO" +
                                  ",HESS_LTR_REF_DATE,HESS_EFF_DATE,HESS_FROM_DESIG_ID,HESS_DESIG_ID,HESS_FROM_DEPT_ID,HESS_TO_DEPT_ID,HESS_REPO_TO_ECODE" +
                                  ",HESS_REPO_TO_BRANCH_CODE,HESS_REMARKS,HESS_BASIC,HESS_HRA,HESS_CCA,HESS_CONV_ALW,HESS_LTA_ALW,HESS_SPL_ALW,HESS_UNF_ALW" +
                                  ",HESS_VEH_ALW,HESS_CH_ED_ALW,HESS_BNP_ALW,HESS_MED_REIMB,HESS_PET_ALW,HESS_GROSS_SAL,HESS_AUTH_SIGN,HESS_APPR_STATUS,HESS_CREATED_BY,HESS_CREATED_DATE) VALUES(" +
                                  "'" + dtEmpInfo.Rows[0]["CompCode"] + "','" + dtEmpInfo.Rows[0]["BranchCode"] + "','" + cmbCompany.SelectedValue + "','" + cmbBranch.SelectedValue + "','" + dtEmpInfo.Rows[0]["ApplNumber"] +
                                  "'," + dtEmpInfo.Rows[0]["Ecode"] + ",'" + cmbPBType.SelectedValue + "'," + iMax + ",'" + Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MMM/yyyy") + "','" + cmbSalStrType.SelectedValue + "','" + cmbSalStrCode.SelectedValue +
                                  "','" + txtRefNo.Text + "',getdate(),'" + Convert.ToDateTime(dtpEffDate.Value).ToString("dd/MMM/yyyy") + "'," + dtEmpInfo.Rows[0]["DesgID"] + "," + sDesg[0] + "," + dtEmpInfo.Rows[0]["DeptCode"] + "," + cmbDepartMent.SelectedValue +
                                  "," + txtReportingEcode.Text + ",'" + cmbRepToBranch.SelectedValue + "','" + txtRemarks.Text + "'," + iBasic + "," + iHra + "," + iCca + "," + iConv +
                                  "," + iLta + "," + iSpec + "," + iUnif + "," + iVeh + "," + iChild + "," + iBnp + "," + iMed + "," + iPet + "," + iGross + "," + cmbAuthortySign.SelectedValue +
                                  ",'P','" + CommonData.LogUserId + "',getdate())";
                    }
                    else
                    {
                        sqlText = "UPDATE HR_EMP_SAL_STRU SET " +
                                  "HESS_PROMOTION_CATEGORY_CODE='" + cmbPBType.SelectedValue + "'" +
                                  ",HESS_TO_COMPANY_CODE='" + cmbCompany.SelectedValue + "'" +
                                  ",HESS_TO_BRANCH_CODE='" + cmbBranch.SelectedValue + "'" +
                                  ",HESS_SALSTRU_TYPE='" + cmbSalStrType.SelectedValue + "'" +
                                  ",HESS_SALSTRU_CODE='" + cmbSalStrCode.SelectedValue + "'" +
                                  ",HESS_LTR_REF_NO='" + txtRefNo.Text + "'" +
                                  ",HESS_EFF_DATE='" + Convert.ToDateTime(dtpEffDate.Value).ToString("dd/MMM/yyyy") + "'" +
                                  ",HESS_TO_DEPT_ID=" + cmbDepartMent.SelectedValue +
                                  ",HESS_DESIG_ID=" + sDesg[0] +
                                  ",HESS_REPO_TO_ECODE=" + txtReportingEcode.Text +
                                  ",HESS_REPO_TO_BRANCH_CODE='" + cmbRepToBranch.SelectedValue + "'" +
                                  ",HESS_REMARKS='" + txtRemarks.Text + "'" +
                                  ",HESS_BASIC=" + iBasic +
                                  ",HESS_HRA=" + iHra +
                                  ",HESS_CCA=" + iCca +
                                  ",HESS_CONV_ALW=" + iConv +
                                  ",HESS_LTA_ALW=" + iLta +
                                  ",HESS_SPL_ALW=" + iSpec +
                                  ",HESS_UNF_ALW=" + iUnif +
                                  ",HESS_VEH_ALW=" + iVeh +
                                  ",HESS_CH_ED_ALW=" + iChild +
                                  ",HESS_BNP_ALW=" + iBnp +
                                  ",HESS_MED_REIMB=" + iMed +
                                  ",HESS_PET_ALW=" + iPet +
                                  ",HESS_GROSS_SAL=" + iGross +
                                  ",HESS_MODIFIED_BY='" + CommonData.LogUserId + "'" +
                                  ",HESS_MODIFIED_DATE=getdate()" +
                                  ",HESS_AUTH_SIGN='" + cmbAuthortySign.SelectedValue + "'" +
                                  " WHERE HESS_TRXN_NO=" + dtEmpSal.Rows[0]["HESS_TRXN_NO"].ToString() + " AND HESS_APPL_NUMBER=" + dtEmpSal.Rows[0]["HESS_APPL_NUMBER"].ToString();
                    }
                    if (sqlText.Length > 10)
                    {
                        iRes = objDB.ExecuteSaveData(sqlText);
                    }
                    //if (iRes > 0)
                    //{
                    //    sqlText = "UPDATE EORA_MASTER SET BRANCH_CODE='" + cmbBranch.SelectedValue.ToString() + "'" +
                    //                ",company_code='" + cmbCompany.SelectedValue.ToString() + "'" +
                    //                ",DEPT_ID='" + cmbDepartMent.SelectedValue.ToString() + "'" +
                    //                ",DESG_ID='" + sDesg[0] + "'" +
                    //                ",DESIG='" + cmbDesignation.SelectedText.ToString() + "'" +
                    //                ",HRIS_DESIG='" + cmbDesignation.SelectedText.ToString() + "'" +
                    //                ",HRIS_DESIG_ID='" + sDesg[0] + "'" +
                    //                ",elevel_id='" + sDesg[1] + "'" +
                    //                "WHERE ECODE = '" + txtEcodeSearch.Text + "'";
                    //    iRes = objDB.ExecuteSaveData(sqlText);
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    objDB = null;
                }
                if (iRes > 0)
                {
                    MessageBox.Show("Data Saved Successfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (cmbPBType.SelectedValue.ToString() == "TRN")
                    {
                        ReportViewer cldReportViewer = new ReportViewer("", "", dtEmpInfo.Rows[0]["ApplNumber"].ToString(), dtEmpInfo.Rows[0]["Ecode"].ToString(), txtRefNo.Text, "TRN");
                        CommonData.ViewReport = "PROMOTION_BOARD_TRN_LETTER";
                        cldReportViewer.Show();
                    }

                    btnClear_Click(null, null);
                }
                else
                {
                    MessageBox.Show("Data Not Saved", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (objPromotionBoardApproval != null)
            {
                ((PromotionBoardApproval)objPromotionBoardApproval).FillPromotionsToGrid();
                this.Close();
                this.Dispose();
            }
        }
Пример #9
0
 private void btnReport_Click(object sender, EventArgs e)
 {
     childReportViewer     = new ReportViewer();
     CommonData.ViewReport = "SSCRM_REP_DOCMM_GROUPSX";
     childReportViewer.Show();
 }
        private void gvEmpPromotionDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            objSQLdb = new SQLDB();
            DataTable dt   = new DataTable();
            int       iRes = 0;

            try
            {
                string strCmd = "SELECT HLPH_LETTER_REF_NO,HLPH_APPL_NO FROM " +
                                "HR_PB_LETTER_PRINT_HIST " +
                                " WHERE HLPH_APPL_NO=" + Convert.ToInt32(gvEmpPromotionDetails.Rows[e.RowIndex].Cells["ApplNo"].Value) +
                                " AND HLPH_LETTER_REF_NO='" + gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterRefNo"].Value.ToString() +
                                "' AND HLPH_PB_TYPE='" + gvEmpPromotionDetails.Rows[e.RowIndex].Cells["PromotionCode"].Value.ToString() + "' ";
                dt = objSQLdb.ExecuteDataSet(strCmd).Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            //DialogResult dlgResult = MessageBox.Show("Do you want Print This Letter?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            //if(dlgResult==DialogResult.Yes)
            //{
            if (e.ColumnIndex == gvEmpPromotionDetails.Columns["Print"].Index)
            {
                if (gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterType"].Value.ToString() == "APPOINTMENT" &&
                    gvEmpPromotionDetails.Rows[e.RowIndex].Cells["DeptName"].Value.ToString() == "SALES")
                {
                    if (dt.Rows.Count == 0)
                    {
                        try
                        {
                            CommonData.ViewReport = "PRINT_SALES_APPT_LETTER";
                            ReportViewer childReportViewer = new ReportViewer(Convert.ToInt32(gvEmpPromotionDetails.Rows[e.RowIndex].Cells["ApplNo"].Value).ToString(), gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterRefNo"].Value.ToString());
                            childReportViewer.Show();

                            string strInsert = "INSERT INTO HR_PB_LETTER_PRINT_HIST(HLPH_APPL_NO " +
                                               ", HLPH_PB_TYPE " +
                                               ", HLPH_LETTER_REF_NO " +
                                               ", HLPH_PRINT_DATE " +
                                               ")VALUES" +
                                               "(" + Convert.ToInt32(gvEmpPromotionDetails.Rows[e.RowIndex].Cells["ApplNo"].Value) +
                                               ",'" + gvEmpPromotionDetails.Rows[e.RowIndex].Cells["PromotionCode"].Value.ToString() +
                                               "','" + gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterRefNo"].Value.ToString() +
                                               "',getdate())";

                            if (strInsert.Length > 10)
                            {
                                iRes = objSQLdb.ExecuteSaveData(strInsert);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        //if (iRes > 0)
                        //{
                        //    MessageBox.Show("Data Saved Successfully", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //}
                        //else
                        //{
                        //    MessageBox.Show("Data Not Saved", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //}
                    }
                    else
                    {
                        MessageBox.Show("Letter Already Printed", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                if (gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterType"].Value.ToString() == "TRANSFER")
                {
                    if (dt.Rows.Count == 0)
                    {
                        ReportViewer cldReportViewer = new ReportViewer("", "", gvEmpPromotionDetails.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvEmpPromotionDetails.Rows[e.RowIndex].Cells["ApplNo"].Value.ToString(), gvEmpPromotionDetails.Rows[e.RowIndex].Cells["LetterRefNo"].Value.ToString(), "TRN");
                        CommonData.ViewReport = "PROMOTION_BOARD_TRN_LETTER";
                        cldReportViewer.Show();
                    }
                    else
                    {
                        MessageBox.Show("Letter Already Printed", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            //}
        }