Beispiel #1
0
 /// <summary>
 /// On 'Print' button click to print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvPayHead.RowCount > 0)
         {
             DataSet   ds          = new DataSet();
             PayHeadSP spPayHead   = new PayHeadSP();
             DataTable dtbl        = spPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text);
             CompanySP spCompany   = new CompanySP();
             DataTable dtblCompany = spCompany.CompanyViewDataTable(1);
             frmReport frmreport   = new frmReport();
             frmreport.MdiParent = formMDI.MDIObj;
             ds.Tables.Add(dtbl);
             ds.Tables.Add(dtblCompany);
             frmreport.PayHeadReport(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PHR:7 " + ex.Message;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadId   = decPayHeadId;
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.Text;
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), infoPayhead.PayHeadId) == false)
         {
             spPayhead.PayHeadEdit(infoPayhead);
             GridFill();
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Payhead name already exist");
             txtPayheadName.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH2:" + ex.Message;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Function for save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.SelectedItem.ToString();
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         infoPayhead.ExtraDate   = DateTime.Parse(DateTime.Now.ToString());
         infoPayhead.Extra1      = string.Empty;
         infoPayhead.Extra2      = string.Empty;
         if (btnPayheadSave.Text == "Save")
         {
             if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), 0) == false)
             {
                 Messages.SavedMessage();
                 spPayhead.PayHeadAdd(infoPayhead);
                 GridFill();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage("Payhead name already exist");
                 txtPayheadName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH1:" + ex.Message;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Fills controls for updation on cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPayhead_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             PayHeadInfo infoPayhead = new PayHeadInfo();
             PayHeadSP   spPayhead   = new PayHeadSP();
             infoPayhead              = spPayhead.PayHeadView(Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString()));
             txtPayheadName.Text      = infoPayhead.PayHeadName;
             cmbPayheadType.Text      = infoPayhead.Type;
             strPayheadType           = cmbPayheadType.Text;
             txtPayheadNarration.Text = infoPayhead.Narration;
             btnPayheadSave.Text      = "Update";
             btnPayheadDelete.Enabled = true;
             strPayHeadName           = infoPayhead.PayHeadName;
             decPayHeadId             = Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString());
             if (spPayhead.payheadTypeCheckeferences(infoPayhead.PayHeadId, txtPayheadName.Text, cmbPayheadType.Text, txtPayheadNarration.Text))
             {
                 if (e.RowIndex != -1)
                 {
                     cmbPayheadType.Enabled = true;
                 }
             }
             else
             {
                 cmbPayheadType.Enabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH14:" + ex.Message;
     }
 }
Beispiel #5
0
        /// <summary>
        /// Fills PayHead in datagridview on cell begin edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvSalaryPackage_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            try
            {
                DataTable dtbl      = new DataTable();
                PayHeadSP SPPayHead = new PayHeadSP();


                if (dgvSalaryPackage.CurrentCell.ColumnIndex == dgvSalaryPackage.Columns["dgvcmbPayHead"].Index)
                {
                    dtbl = SPPayHead.PayHeadViewAll();
                    if (dtbl.Rows.Count < 2)
                    {
                        DataRow dr = dtbl.NewRow();
                        dr[0] = 0;
                        dr[1] = 0;
                        dtbl.Rows.InsertAt(dr, 0);
                    }
                    if (dgvSalaryPackage.RowCount > 1)
                    {
                        int inGridRowCount = dgvSalaryPackage.RowCount;
                        for (int inI = 0; inI < inGridRowCount - 1; inI++)
                        {
                            if (inI != e.RowIndex)
                            {
                                int inTableRowcount = dtbl.Rows.Count;
                                for (int inJ = 0; inJ < inTableRowcount; inJ++)
                                {
                                    if (dgvSalaryPackage.Rows[inI].Cells["dgvcmbPayHead"].Value != null && dgvSalaryPackage.Rows[inI].Cells["dgvcmbPayHead"].Value.ToString() != string.Empty)
                                    {
                                        if (dtbl.Rows[inJ]["payHeadId"].ToString() == dgvSalaryPackage.Rows[inI].Cells["dgvcmbPayHead"].Value.ToString())
                                        {
                                            dtbl.Rows.RemoveAt(inJ);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    DataGridViewComboBoxCell dgvccPayHead = (DataGridViewComboBoxCell)dgvSalaryPackage[dgvSalaryPackage.Columns["dgvcmbPayHead"].Index, e.RowIndex];
                    dgvccPayHead.DataSource    = dtbl;
                    dgvccPayHead.ValueMember   = "payHeadId";
                    dgvccPayHead.DisplayMember = "payHeadName";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "SPC25:" + ex.Message;
            }
        }
Beispiel #6
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         PayHeadSP spPayHead = new PayHeadSP();
         DataTable dtbl      = spPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text);
         dgvPayHead.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PHR:2 " + ex.Message;
     }
 }
Beispiel #7
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         PayHeadSP spPayhead   = new PayHeadSP();
         DataTable dtblPayhead = new DataTable();
         dtblPayhead           = spPayhead.PayHeadSearch(txtPayheadSearch.Text.Trim());
         dgvPayhead.DataSource = dtblPayhead;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH4:" + ex.Message;
     }
 }
Beispiel #8
0
 /// <summary>
 /// Function to fill PayHead combobox
 /// </summary>
 public void GridPayHeadFill()
 {
     try
     {
         PayHeadSP SPPayHead   = new PayHeadSP();
         DataTable dtblPayHead = new DataTable();
         dtblPayHead = SPPayHead.PayHeadViewAll();
         DataRow drrow = dtblPayHead.NewRow();
         dtblPayHead.Rows.InsertAt(drrow, 0);
         dgvcmbPayHead.DataSource    = dtblPayHead;
         dgvcmbPayHead.ValueMember   = "payHeadId";
         dgvcmbPayHead.DisplayMember = "payHeadName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SPC7:" + ex.Message;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Function to fill PayHead combobox
 /// </summary>
 public void PayHeadComboFill()
 {
     try
     {
         PayHeadSP spPayHead   = new PayHeadSP();
         DataTable dtblPayHead = spPayHead.PayHeadViewAll();
         DataRow   dr          = dtblPayHead.NewRow();
         dr[2] = "All";
         dtblPayHead.Rows.InsertAt(dr, 0);
         cmbPayHead.DataSource    = dtblPayHead;
         cmbPayHead.ValueMember   = "payHeadId";
         cmbPayHead.DisplayMember = "payHeadName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PHR:1 " + ex.Message;
     }
 }
Beispiel #10
0
 /// <summary>
 /// Function for Delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         PayHeadInfo infoPayhead = new PayHeadInfo();
         PayHeadSP   spPayhead   = new PayHeadSP();
         if (spPayhead.PayHeadDeleteVoucherTypeCheckReference(decPayHeadId))
         {
             Messages.ReferenceExistsMessage();
             txtPayheadName.Focus();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
         }
         GridFill();
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH6:" + ex.Message;
     }
 }