/// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         if (cmbCashBankAC.Text.Trim() == string.Empty)
         {
             if (cmbCashBankAC.DropDownStyle != ComboBoxStyle.DropDown)
             {
                 cmbCashBankAC.DropDownStyle = ComboBoxStyle.DropDown;
             }
             cmbCashBankAC.Text = "All";
         }
         DataTable             dtbl = new DataTable();
         SalaryVoucherMasterSP spSalaryVoucherMaster = new SalaryVoucherMasterSP();
         dtbl = spSalaryVoucherMaster.MonthlySalaryRegisterSearch(Convert.ToDateTime(txtVoucherDateFrom.Text.Trim().ToString()), Convert.ToDateTime(txtVoucherDateTo.Text.Trim().ToString()), Convert.ToDateTime(dtpSalaryMonth.Value.ToString("MMMM yyyy")), txtVoucherNo.Text.Trim(), cmbCashBankAC.Text.ToString(), cmbVoucherTypeName.Text.ToString());
         dgvMonthlySalaryRegister.DataSource = dtbl;
         if (cmbCashBankAC.Text == "All")
         {
             cmbCashBankAC.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MSR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #2
0
        /// <summary>
        /// Function for print
        /// </summary>
        public void Print()
        {
            try
            {
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnPrint.Text))
                {
                    if (cmbEmployee.Text == string.Empty || cmbEmployee.Text == "--Select--")
                    {
                        Messages.InformationMessage("Select an employee");
                        cmbEmployee.Focus();
                    }
                    else
                    {
                        SalaryVoucherMasterSP spSalaryVoucherMaster = new SalaryVoucherMasterSP();
                        DateTime dtMon         = DateTime.Parse(dtpSalaryMonth.Text);
                        DateTime dtSalaryMonth = new DateTime(dtMon.Year, dtMon.Month, 1);
                        decimal  decEmployeeId = Convert.ToDecimal(cmbEmployee.SelectedValue.ToString());
                        DataSet  dsPaySlip     = spSalaryVoucherMaster.PaySlipPrinting(decEmployeeId, dtSalaryMonth, 1);

                        foreach (DataTable dtbl in dsPaySlip.Tables)
                        {
                            if (dtbl.TableName == "Table1")
                            {
                                if (dtbl.Rows.Count > 0)
                                {
                                    ////frmReport //frmReport = new frmReport();
                                    //frmReport.MdiParent = formMDI.MDIObj;
                                    //    frmreport.PaySlipPrinting(dsPaySlip);
                                }
                                else
                                {
                                    MessageBox.Show("Salary not paid", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Messages.NoPrivillageMessage();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS 3: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }