Ejemplo n.º 1
0
 /// <summary>
 /// Function to fill AgainstOrder combobox
 /// </summary>
 public void AgainstOrderComboFill()
 {
     try
     {
         bool isEveryComboFill = false;
         SalesOrderMasterSP     spSalesOrder      = new SalesOrderMasterSP();
         SalesQuotationMasterSP spQuotationMaster = new SalesQuotationMasterSP();
         DataTable dtblOrderFill = new DataTable();
         if (cmbCashOrParty.SelectedValue.ToString() != null && cmbDeliveryMode.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             cmbOrderNo.Text = string.Empty;
             if (strTypeOfVoucher == "Sales Order")
             {
                 dtblOrderFill = spSalesOrderMaster.GetSalesOrderInvoiceNumberCorrespondingToLedgerId(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString()));
                 DataRow dr = dtblOrderFill.NewRow();
                 dr[0] = "0";
                 dr[1] = string.Empty;
                 dtblOrderFill.Rows.InsertAt(dr, 0);
                 cmbOrderNo.DataSource = dtblOrderFill;
                 if (dtblOrderFill.Rows.Count > 0)
                 {
                     cmbOrderNo.DisplayMember = "invoiceNo";
                     cmbOrderNo.ValueMember   = "salesOrderMasterId";
                     cmbOrderNo.SelectedIndex = 0;
                 }
             }
             else if (strTypeOfVoucher == "Sales Quotation")
             {
                 dtblOrderFill = spQuotationMaster.GetSalesQuotationNumberCorrespondingToLedger(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), Convert.ToDecimal(cmbDeliveryMode.SelectedValue.ToString()));
                 DataRow dr = dtblOrderFill.NewRow();
                 dr[0] = "0";
                 dr[1] = string.Empty;
                 dtblOrderFill.Rows.InsertAt(dr, 0);
                 cmbOrderNo.DataSource = dtblOrderFill;
                 if (dtblOrderFill.Rows.Count > 0)
                 {
                     cmbOrderNo.DisplayMember = "invoiceNo";
                     cmbOrderNo.ValueMember   = "quotationMasterId";
                 }
             }
             else
             {
                 GridFill();
             }
         }
         isEveryComboFill = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREP06: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         DataTable          dtblSalesOrderRegister = new DataTable();
         SalesOrderMasterSP spSalesOrderMaster     = new SalesOrderMasterSP();
         if (cmbSalesOrderNo.SelectedIndex == 0 || cmbSalesOrderNo.SelectedIndex == -1)
         {
             strInvoiceNo = "All";
         }
         else
         {
             strInvoiceNo = cmbSalesOrderNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (rbtnAll.Checked == true)
         {
             strCondition = "All";
         }
         if (rbtnPendingOrder.Checked == true)
         {
             strCondition = "Pending";
         }
         if (rbtnOverdue.Checked == true)
         {
             strCondition = "Due";
         }
         if (rbtnCancelled.Checked == true)
         {
             strCondition = "Cancelled";
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate   = this.dtpToDate.Value;
         dtblSalesOrderRegister           = spSalesOrderMaster.SalesOrderRegisterSearch(strInvoiceNo, decLedgerId, FromDate, ToDate, strCondition);
         dgvSalesOrderRegister.DataSource = dtblSalesOrderRegister;
         if (dgvSalesOrderRegister.Columns.Count > 0)
         {
             dgvSalesOrderRegister.Columns["dgvtxtBillAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SOREG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
        /// <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;
                DataTable  dtbl       = new DataTable();
                ReminderSP SpReminder = new ReminderSP();
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverduePurchaseOrder", "View"))
                {
                    PurchaseOrderMasterSP SpPurchaseOrderMaster = new PurchaseOrderMasterSP();
                    dtbl = SpPurchaseOrderMaster.PurchaseOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Purchasereminder = Purchasereminder + "1 Overdue purchase order\n\n";
                        }
                        else
                        {
                            Purchasereminder = Purchasereminder + dtbl.Rows.Count + " Overdue purchase orders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverdueSalesOrder", "View"))
                {
                    SalesOrderMasterSP SpSalesOrderMaster = new SalesOrderMasterSP();
                    dtbl = SpSalesOrderMaster.SalesOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Salesreminder = Salesreminder + "1 Overdue sales order\n\n";
                        }
                        else
                        {
                            Salesreminder = Salesreminder + dtbl.Rows.Count + " Overdue sales orders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Delete Item") ||
                    CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Update") ||
                    CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Save"))
                {
                    string FromDate = Convert.ToString(PublicVariables._dtCurrentDate);
                    string ToDate   = Convert.ToString(PublicVariables._dtCurrentDate);
                    dtbl = SpReminder.ReminderSearch(FromDate, ToDate);
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Personalreminder = Personalreminder + "1 personal reminder \n\n";
                        }
                        else
                        {
                            Personalreminder = Personalreminder + dtbl.Rows.Count + " Personal reminders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmShortExpiry", "View"))
                {
                    dtbl = SpReminder.ShortExpiryReminder(0, 0, 0, 0, 0, 0, 0, 0);
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            ShortExpiryReminder = ShortExpiryReminder + "1 Product batch is going to expire";
                        }
                        else
                        {
                            ShortExpiryReminder = ShortExpiryReminder + dtbl.Rows.Count + " Product batches going to expire";
                        }
                    }
                }
                //frmStock
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmStock", "View"))
                {
                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Negative Stock");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            NegativeStkreminder = NegativeStkreminder + "1 Negative stock product \n\n";
                        }
                        else
                        {
                            NegativeStkreminder = NegativeStkreminder + dtbl.Rows.Count + " Negative stock products\n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Minimum Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            MinStkreminder = MinStkreminder + "1 Minimum stock product \n\n";
                        }
                        else
                        {
                            MinStkreminder = MinStkreminder + dtbl.Rows.Count + "  Minimum stock products \n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Maximum Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            MaxStkreminder = MaxStkreminder + "1 Maximum stock product \n\n";
                        }
                        else
                        {
                            MaxStkreminder = MaxStkreminder + dtbl.Rows.Count + "  Maximum stock products \n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Reorder Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            ReordrStkreminder = ReordrStkreminder + "1 Reorder Level product \n\n";
                        }
                        else
                        {
                            ReordrStkreminder = ReordrStkreminder + dtbl.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);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         if (txtVoucherNo.Text.Trim() == string.Empty)
         {
             strInvoiceNo = "-1";
         }
         else
         {
             strInvoiceNo = txtVoucherNo.Text;
         }
         if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1)
         {
             decLedgerId = -1;
         }
         else
         {
             decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         }
         if (cmbVoucherType.SelectedIndex == 0 || cmbVoucherType.SelectedIndex == -1)
         {
             decVoucherTypeId = -1;
         }
         else
         {
             decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         }
         if (cmbSalesMan.SelectedIndex == 0 || cmbSalesMan.SelectedIndex == -1)
         {
             decEmployeeId = -1;
         }
         else
         {
             decEmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
         }
         if (txtProductCode.Text.Trim() == string.Empty)
         {
             strProductCode = string.Empty;
         }
         else
         {
             strProductCode = txtProductCode.Text;
         }
         if (cmbArea.SelectedIndex == 0 || cmbArea.SelectedIndex == -1)
         {
             decAreaId = -1;
         }
         else
         {
             decAreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         }
         if (cmbRoute.SelectedIndex == 0 || cmbRoute.SelectedIndex == -1)
         {
             decRouteId = -1;
         }
         else
         {
             decRouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         }
         if (cmbProductGroup.SelectedIndex == 0 || cmbProductGroup.SelectedIndex == -1)
         {
             decGroupId = -1;
         }
         else
         {
             decGroupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString());
         }
         if (cmbQuotationNo.SelectedIndex == 0)
         {
             strSalesQuotationNo = "-1";
         }
         else
         {
             strSalesQuotationNo = cmbQuotationNo.SelectedValue.ToString();
         }
         if (cmbStatus.SelectedIndex == 0 || cmbStatus.SelectedIndex == -1)
         {
             strStatus = "All";
         }
         else
         {
             strStatus = cmbStatus.SelectedItem.ToString();
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate   = this.dtpToDate.Value;
         dtblSalesOrderReport = spSalesOrderMaster.SalesOrderReportViewAll(strInvoiceNo, decLedgerId, strProductCode, decVoucherTypeId, FromDate, ToDate, strStatus, decEmployeeId, strSalesQuotationNo, decAreaId, decGroupId, decRouteId);
         if (dtblSalesOrderReport.Rows.Count > 0)
         {
             decimal decTotal = 0;
             for (int i = 0; i < dtblSalesOrderReport.Rows.Count; i++)
             {
                 if (dtblSalesOrderReport.Rows[i]["totalAmount"].ToString() != null)
                 {
                     decTotal = decTotal + Convert.ToDecimal(dtblSalesOrderReport.Rows[i]["totalAmount"].ToString());
                 }
             }
             decTotal            = Math.Round(decTotal, 2);
             txtTotalAmount.Text = decTotal.ToString();
         }
         else
         {
             txtTotalAmount.Text = "0.00";
         }
         dgvSalesOrderReport.DataSource = dtblSalesOrderReport;
         if (dgvSalesOrderReport.Columns.Count > 0)
         {
             dgvSalesOrderReport.Columns["dgvtxtTotalAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }