예제 #1
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         RemainderBll bllRemainder = new RemainderBll();
         List<DataTable> list = new List<DataTable>();
         string strCriteria = string.Empty;
         if (rbtnAll.Checked)
         {
             strCriteria = "All";
         }
         if (rbtnMax.Checked)
         {
             strCriteria = "Maximum Level";
         }
         if (rbtnMin.Checked)
         {
             strCriteria = "Minimum Level";
         }
         if (rbtnNegativestock.Checked)
         {
             strCriteria = "Negative Stock";
         }
         if (rbtnReorder.Checked)
         {
             strCriteria = "Reorder Level";
         }
         list = bllRemainder.StockSearch(Convert.ToDecimal(cmbGroup.SelectedValue),
             Convert.ToDecimal(cmbProduct.SelectedValue), Convert.ToDecimal(cmbBrand.SelectedValue),
             Convert.ToDecimal(cmbSize.SelectedValue), Convert.ToDecimal(cmbModelNo.SelectedValue),
             Convert.ToDecimal(cmbTax.SelectedValue), Convert.ToDecimal(cmbGodown.SelectedValue),
             Convert.ToDecimal(cmbRack.SelectedValue), strCriteria);
         dgvStock.DataSource = list[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Fills controls for updation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvRemainder_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            RemainderBll bllRemainder = new RemainderBll();
            try
            {
                if (dgvRemainder.CurrentRow != null)
                {
                    if (dgvRemainder.CurrentRow.Cells["reminderId"].Value != null)
                    {
                        if (dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString() != string.Empty)
                        {
                            decReminderId = Convert.ToDecimal(dgvRemainder.CurrentRow.Cells["reminderId"].Value.ToString());

                            ReminderInfo infoReminder = new ReminderInfo();
                            infoReminder = bllRemainder.RemainderView(decReminderId);
                            dtpFromDate.Value = infoReminder.FromDate;
                            dtpToDate.Value = infoReminder.ToDate;
                            txtRemindAbout.Text = infoReminder.RemindAbout;
                            txtFromDate.Focus();
                            btnSave.Text = "Update";
                            btnDelete.Enabled = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PREM12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 private void OverDuePurchaseOrderGridFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         RemainderBll bllRemainder = new RemainderBll();
         if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView" && cmbAccountLedger.Text != "System.Data.DataRowView")
         {
             decimal decLedgerId = decimal.Parse(cmbAccountLedger.SelectedValue.ToString());
             listObj = bllRemainder.OverDuePurchaseOrdersCorrespondingAccountLedger(decLedgerId);
             dgvOverduePurchaseOrder.DataSource = listObj[0];
             dgvOverduePurchaseOrder.Columns["PurchaseOrderMasterId"].Visible = false;
             dgvOverduePurchaseOrder.Columns["InvoicedMasterId"].Visible = false;
             dgvOverduePurchaseOrder.Columns["MR_OrderMasterId"].Visible = false;
             dgvOverduePurchaseOrder.Columns["ledgerId"].Visible = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ODPO:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void ReminderGridFill()
 {
     try
     {
         RemainderBll bllRemainder = new RemainderBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = bllRemainder.ReminderSearch(txtFromDateSearch.Text, txtToDateSearch.Text);
         dgvRemainder.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RemainderBll bllRemainder = new RemainderBll();
         ReminderInfo infoReminder = new ReminderInfo();
         infoReminder.FromDate = dtpFromDate.Value;
         infoReminder.ToDate = dtpToDate.Value;
         infoReminder.RemindAbout = txtRemindAbout.Text.Trim();
         infoReminder.Extra1 = PublicVariables._decCurrentUserId.ToString();
         infoReminder.Extra2 = string.Empty;
         infoReminder.ExtraDate = DateTime.Now;
         if (bllRemainder.ReminderAdd(infoReminder))
         {
             Messages.SavedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to print the report
 /// </summary>
 public void PrintReport()
 {
     try
     {
        // ReminderSP SPReminder = new ReminderSP();
         RemainderBll bllRemainder = new RemainderBll();
         decimal decA = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
         decimal decB = Convert.ToDecimal(cmbProductName.SelectedValue.ToString());
         decimal decC = Convert.ToDecimal(cmbBrand.SelectedValue.ToString());
         decimal decD = Convert.ToDecimal(cmbSize.SelectedValue.ToString());
         decimal decE = Convert.ToDecimal(cmbModelno.SelectedValue.ToString());
         decimal decF = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         decimal decG = Convert.ToDecimal(cmbRack.SelectedValue.ToString());
         decimal decproExp = 0;
         string strproExp = string.Empty;
         if (txtProductExpire.Text != string.Empty)
         {
             decproExp = Convert.ToDecimal(txtProductExpire.Text.ToString());
         }
         else
         {
             decproExp = 0;
         }
         if (cmbProductExpire.Text != string.Empty)
         {
             strproExp = cmbProductExpire.Text;
         }
         else
         {
             strproExp = string.Empty;
         }
         DataSet dsShortExpiryReport = bllRemainder.ShortExpiryReportPrinting(decA, decB, decC, decD, decE, decF, decG, decproExp, strproExp, PublicVariables._dtCurrentDate, 1);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         if (dgvShortExpiryReport.Rows.Count > 0)
         {
             frmReport.ShortExpiryReportPrinting(dsShortExpiryReport);
         }
         else
         {
             Messages.InformationMessage("No Data Found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SER:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Delete
 /// </summary>
 public void Delete()
 {
     try
     {
        // ReminderSP spReminder = new ReminderSP();
         RemainderBll bllRemainder = new RemainderBll();
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage() == true)
             {
                 isDeleteStatus = bllRemainder.RemainderDelete(decReminderId);
                 if (isDeleteStatus)
                 {
                     Messages.DeletedMessage();
                     Clear();
                 }
             }
         }
         else
         {
             isDeleteStatus = bllRemainder.RemainderDelete(decReminderId);
             if (isDeleteStatus)
             {
                 Messages.DeletedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREM4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill the short expiry products
        /// </summary>
        public void GridFill()
        {
            RemainderBll bllRemainder = new RemainderBll();
            try
            {
                List<DataTable> list = new List<DataTable>();

                decimal decA = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
                decimal decB = Convert.ToDecimal(cmbProductName.SelectedValue.ToString());
                decimal decC = Convert.ToDecimal(cmbBrand.SelectedValue.ToString());
                decimal decD = Convert.ToDecimal(cmbSize.SelectedValue.ToString());
                decimal decE = Convert.ToDecimal(cmbModelno.SelectedValue.ToString());
                decimal decF = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
                decimal decG = Convert.ToDecimal(cmbRack.SelectedValue.ToString());
                decimal decproExp = 0;
                string strproExp = string.Empty;
                if (txtProductExpire.Text != string.Empty)
                {
                    decproExp = Convert.ToDecimal(txtProductExpire.Text.ToString());
                }
                else
                {
                    decproExp = 0;
                }
                if (cmbProductExpire.Text != string.Empty)
                {
                    strproExp = cmbProductExpire.Text;
                }
                else
                {
                    strproExp = string.Empty;
                }
                list = bllRemainder.ShortExpiryReportGridFill(decA, decB, decC, decD, decE, decF, decG, decproExp, strproExp, PublicVariables._dtCurrentDate);
                dgvShortExpiryReport.DataSource = list[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("SER:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to fill Datagridview
        /// </summary>
        public void OverDueSalesOrderGridFill()
        {
            RemainderBll bllRemainder = new RemainderBll();
            List<DataTable> listObj = new List<DataTable>();
            try
            {

                if (cmbAccountLeadger.SelectedValue.ToString() != "System.Data.DataRowView" && cmbAccountLeadger.Text != "System.Data.DataRowView")
                {
                    decimal decLedgerId = decimal.Parse(cmbAccountLeadger.SelectedValue.ToString());
                    listObj=bllRemainder.OverdueSalesOrderCorrespondingAccountLedger(decLedgerId);
                    dgvOverdueSalesOrder.DataSource = listObj[0];
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ODSO2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Showing Reminder If Any one have
        /// </summary>
        public void ShowReminderIfAny()
        {
            try
            {
                string Purchasereminder = string.Empty;
                string Salesreminder = string.Empty;
                string Personalreminder = string.Empty;
                string NegativeStkreminder = string.Empty;
                string MinStkreminder = string.Empty;
                string MaxStkreminder = string.Empty;
                string ReordrStkreminder = string.Empty;
                string ShortExpiryReminder = string.Empty;
                List<DataTable> ListObj = new List<DataTable>();
                PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll();
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverduePurchaseOrder", "View"))
                {
                    ListObj = BllPurchaseOrder.PurchaseOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            Purchasereminder = Purchasereminder + "1 Overdue purchase order\n\n";
                        else
                            Purchasereminder = Purchasereminder + ListObj[0].Rows.Count + " Overdue purchase orders\n\n";
                    }
                }
                SalesOrderBll bllSalesOrder = new SalesOrderBll();
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverdueSalesOrder", "View"))
                {
                    ListObj = bllSalesOrder.SalesOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            Salesreminder = Salesreminder + "1 Overdue sales order\n\n";
                        else
                            Salesreminder = Salesreminder + ListObj[0].Rows.Count + " Overdue sales orders\n\n";
                    }
                }
                RemainderBll bllRemainder = new RemainderBll();
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Delete") ||
            CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Update") ||
            CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Save"))
                {
                    string FromDate = Convert.ToString(PublicVariables._dtCurrentDate);
                    string ToDate = Convert.ToString(PublicVariables._dtCurrentDate);
                    ListObj = bllRemainder.ReminderSearch(FromDate, ToDate);
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            Personalreminder = Personalreminder + "1 personal reminder \n\n";
                        else
                            Personalreminder = Personalreminder + ListObj[0].Rows.Count + " Personal reminders\n\n";
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmShortExpiry", "View"))
                {
                    ListObj = bllRemainder.ShortExpiryReminder(0, 0, 0, 0, 0, 0, 0, 0);
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            ShortExpiryReminder = ShortExpiryReminder + "1 Product batch is going to expire";
                        else
                            ShortExpiryReminder = ShortExpiryReminder + ListObj[0].Rows.Count + " Product batches going to expire";
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmStock", "View"))
                {
                    ListObj = bllRemainder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Negative Stock");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            NegativeStkreminder = NegativeStkreminder + "1 Negative stock product \n\n";
                        else
                            NegativeStkreminder = NegativeStkreminder + ListObj[0].Rows.Count + " Negative stock products\n\n";
                    }

                    ListObj = bllRemainder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Minimum Level");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            MinStkreminder = MinStkreminder + "1 Minimum stock product \n\n";
                        else
                            MinStkreminder = MinStkreminder + ListObj[0].Rows.Count + "  Minimum stock products \n\n";
                    }
                    ListObj = bllRemainder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Maximum Level");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            MaxStkreminder = MaxStkreminder + "1 Maximum stock product \n\n";
                        else
                            MaxStkreminder = MaxStkreminder + ListObj[0].Rows.Count + "  Maximum stock products \n\n";
                    }
                    ListObj = bllRemainder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Reorder Level");
                    if (ListObj[0].Rows.Count > 0)
                    {
                        if (ListObj[0].Rows.Count == 1)
                            ReordrStkreminder = ReordrStkreminder + "1 Reorder Level product \n\n";
                        else
                            ReordrStkreminder = ReordrStkreminder + ListObj[0].Rows.Count + "  Reorder Level products \n\n";
                    }
                }
                if (Salesreminder.Trim() != string.Empty || Purchasereminder.Trim() != string.Empty || Personalreminder.Trim() != string.Empty || NegativeStkreminder.Trim() != string.Empty || MinStkreminder.Trim() != string.Empty || MaxStkreminder.Trim() != string.Empty || ReordrStkreminder.Trim() != string.Empty)
                {
                    frmReminderPopUp frmReminder = new frmReminderPopUp();
                    frmReminderPopUp isOpen = Application.OpenForms["frmReminderPopUp"] as frmReminderPopUp;
                    if (isOpen == null)
                    {
                        frmReminder.WindowState = FormWindowState.Normal;
                        frmReminder.MdiParent = formMDI.MDIObj;
                        frmReminder.BringToFront();
                        frmReminder.ChangeLabel(Salesreminder, Purchasereminder, Personalreminder, ShortExpiryReminder, NegativeStkreminder, MinStkreminder, MaxStkreminder, ReordrStkreminder);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CCD : 13 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to call this form frmReminderPopUp form to view details
 /// </summary>
 /// <param name="frmReminder"></param>
 public void CallFromReminder(frmReminderPopUp frmReminder)
 {
     RemainderBll bllRemainder = new RemainderBll();
     try
     {
         base.Show();
         List<DataTable> list = new List<DataTable>();
         list = bllRemainder.ShortExpiryReminder(0, 0, 0, 0, 0, 0, 0, 0);
         dgvProductExpiry.DataSource = list;
         this.frmReminderPopupObj = frmReminder;
         frmReminderPopupObj.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 public void gridfill()
 {
     RemainderBll bllRemainder = new RemainderBll();
     try
     {
         List<DataTable> list = new List<DataTable>();
         list = bllRemainder.ShortExpiryReminderGridFill(Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), Convert.ToDecimal(cmbProduct.SelectedValue.ToString()), Convert.ToDecimal(cmbBrand.SelectedValue.ToString()), Convert.ToDecimal(cmbSize.SelectedValue.ToString()), Convert.ToDecimal(cmbModelno.SelectedValue.ToString()), Convert.ToDecimal(cmbTax.SelectedValue.ToString()), Convert.ToDecimal(cmbGodown.SelectedValue.ToString()), Convert.ToDecimal(cmbRack.SelectedValue.ToString()));
         dgvProductExpiry.DataSource = list[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }