Beispiel #1
0
 public Credit_Sales_Record()
 {
     InitializeComponent();
     CreditSales.AllCreditSales(dataGridCreditSalesRecord, txtItemSearch.Text);
     lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal);
     ItemSales.ItemNames(combItemName);
 }
Beispiel #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     //DELETE CODE MOT WORKING FINE
     if (DateSelect == true)
     {
         if (MessageBox.Show("All records will be Deleted for Selected Date\nContinue ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             ItemSales.DeleteSale(dateTimeFrom);
             dataAccess.Description = "Deleted all credit Sales record for " + dateTimeFrom.Value.ToString("MM/dd/yyyy");
             dataAccess.Activities();
             CreditSales.AllCreditSales(dataGridCreditSalesRecord, "");
             DateSelect = false;
         }
     }
     else
     {
         if (MessageBox.Show("Confirm Delete of Selected Record", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             //CARRY OUT DELETE
             if (SalesID <= 0)
             {
                 throw new Exception("Select a record to Delete");
             }
             else
             {
                 ItemSales.DeleteSale(SalesID);
                 dataAccess.Description = "Deleted a Credit Sales record";
                 dataAccess.Activities();
                 CreditSales.AllCreditSales(dataGridCreditSalesRecord, "");
                 SalesID = 0;
             }
         }
     }
 }
Beispiel #3
0
 private void txtItemName_Click(object sender, EventArgs e)
 {
     txtItemName.Clear();
     setsales.ItemID      = 0;
     txtItemName.ReadOnly = false;
     ItemSales.DispayItems(dataGridItmes, txtItemName.Text);
     dataGridItmes.Visible = true;
 }
Beispiel #4
0
 private void combItemName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(combItemName.Text))
     {
         ItemSales.TodaySales(dataGridTodaySalesRecord);
     }
     else
     {
         ItemSales.TodaySalesItems(dataGridTodaySalesRecord, combItemName.Text);
     }
 }
Beispiel #5
0
 private void btnAddItem_Click(object sender, EventArgs e)
 {
     try {
         var addItem = new Add_Items();
         addItem.ShowDialog();
         ItemSales.ItemNames(combItemName);
     }
     catch (Exception)
     {
         MessageBox.Show("Something went wrong, Try again.", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #6
0
 private void combItemName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (dateSelect == true)
     {
         ItemSales.AllSalesBetweenDate(dataGridSalesRecord, dateTimeFrom, combItemName.Text);
     }
     else
     {
         ItemSales.AllSalesBetweenDate(dataGridSalesRecord, dateTimeFrom, dateTimeTo, combItemName.Text);
     }
     lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal);
 }
Beispiel #7
0
 private void btnCreditSales_Click(object sender, EventArgs e)
 {
     try {
         var creditsales = new Credit_Sales_Record();
         creditsales.ShowDialog();
         timer1.Start();
         ItemSales.ItemNames(combItemName);
     }catch (Exception)
     {
         MessageBox.Show("Something went wrong, Try again.", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #8
0
 private void btnMakeSale_Click(object sender, EventArgs e)
 {
     try {
         var makeSales = new Make_Sale();
         makeSales.ShowDialog();
         timer1.Start();//start the time when sales form pops up.
         ItemSales.ItemNames(combItemName);
     }
     catch (Exception)
     {
         MessageBox.Show("Something went wrong, Try again.", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #9
0
 private void dataGridItmes_Click(object sender, EventArgs e)
 {
     try
     {
         txtItemName.ReadOnly     = true;
         setsales.ItemID          = Int32.Parse(dataGridItmes.SelectedRows[0].Cells[0].Value.ToString());
         txtSelectedItemName.Text = dataGridItmes.SelectedRows[0].Cells[1].Value.ToString();
         this.ActiveControl       = txtquantity;
         txtSelingPrice.Text      = ItemSales.setSellinPrice(setsales.getItemID()).ToString();
         txtquantity.Text         = "0";
     }
     catch (Exception)
     {
     }
 }
Beispiel #10
0
 private void txtSearchStudent_TextChanged(object sender, EventArgs e)
 {
     try {
         if (string.IsNullOrEmpty(txtSearchStudent.Text))
         {
             ItemSales.DispayStudentNames(dataGridStudentNames, txtSearchStudent.Text);
         }
         else
         {
             ItemSales.DispayStudentNames(dataGridStudentNames, txtSearchStudent.Text);
         }
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Student Search Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #11
0
 private void txtItemSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtItemSearch.Text))
         {
             ItemSales.AllSales(dataGridSalesRecord, txtItemSearch.Text);
             lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal);
         }
         else
         {
             ItemSales.AllSales(dataGridSalesRecord, "");
             lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal);
         }
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #12
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try{
         if (dateSelect == true)
         {
             if (MessageBox.Show("All records will be Deleted for Selected Date\nContinue ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 ItemSales.DeleteSale(dateTimeFrom);
                 dataAccess.Description = "Deleted all Sales record for " + dateTimeFrom.Value.ToString("MM/dd/yyyy");
                 dataAccess.Activities();
                 SalesWithNames.AllNamesSales(dataGridNamesSalesRecord, "");
                 dateSelect = false;
             }
         }
         else
         {
             if (MessageBox.Show("Confirm Delete of Selected Record", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 //CARRY OUT DELETE
                 if (RecordID <= 0)
                 {
                     throw new Exception("Select a record to Delete");
                 }
                 else
                 {
                     ItemSales.DeleteSale(RecordID);
                     dataAccess.Description = "Deleted an item from Sales record";
                     dataAccess.Activities();
                     SalesWithNames.AllNamesSales(dataGridNamesSalesRecord, "");
                     RecordID = 0;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
     }
 }
Beispiel #13
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(stockID))
         {
             throw new Exception("Select a record to perfrom operation");
         }
         if (MessageBox.Show("Are you sure you want to delete ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             setSales.DeleteStock(stockID);
             setSales.DisplayStock(dataGridItmes);
             ItemSales.StockNames(combStockName);
             stockID = "";
             MessageBox.Show("Delete Successful", "Delete");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #14
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (ItemSales.isSaleMade() == true)
            {
                //TODO
                ///REFRESH THE SALES RECOD
                ItemSales.AllSales(dataGridSalesRecord, "");
                timer1.Stop();
            }
            else
            {
                timer1.Stop();
            }

            if (ItemSales.isSaleDeleted() == true)
            {
                ItemSales.AllSales(dataGridSalesRecord, "");
                timer1.Stop();
            }
            else
            {
                timer1.Stop();
            }
        }
Beispiel #15
0
 public Sales_With_Student_Names()
 {
     InitializeComponent();
     SalesWithNames.AllNamesSales(dataGridNamesSalesRecord, "");
     ItemSales.ItemNames(combItemName);
 }
Beispiel #16
0
 public SalesStock()
 {
     InitializeComponent();
     setSales.DisplayStock(dataGridItmes);
     ItemSales.StockNames(combStockName);
 }
Beispiel #17
0
 public Today_Sales_Record()
 {
     InitializeComponent();
     ItemSales.TodaySales(dataGridTodaySalesRecord);
     ItemSales.ItemNames(combItemName);
 }
Beispiel #18
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     ItemSales.TodaySales(dataGridTodaySalesRecord);
 }
Beispiel #19
0
 public Daily_Sales_Report()
 {
     InitializeComponent();
     AllSalesReport.DisplayReport(dataGridDailyReport);
     ItemSales.ItemNames(combItemName);
 }
Beispiel #20
0
        private void btnSubmit2_Click(object sender, EventArgs e)
        {
            try
            {
                if (checkCredit.Checked == true)
                {
                    //operation
                    creditor.SetFirstname(txtFirstname.Text);
                    creditor.SetLasttname(txtLastname.Text);
                    if (string.IsNullOrEmpty(txtContact.Text))
                    {
                        if (MessageBox.Show("Creditor's Contact is empty\ncontinue ?", "Contact Error", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                        {
                            creditor.SetContact("");
                        }
                        else
                        {
                            throw new Exception("Please provide contact infor and continue");
                        }
                    }
                    else
                    {
                        if (txtContact.Text.Length < 11 || txtContact.Text.Length > 11)
                        {
                            throw new Exception("Creditor's Contact has Invalid length of digits");
                        }
                        creditor.SetContact(txtContact.Text);
                    }

                    setsales.SetQuantity(txtquantity.Text);
                    setsales.SetSellinPrice(txtSelingPrice.Text);
                    if (setsales.getItemID() <= 0)
                    {
                        throw new Exception("Item Not found, Select and item");
                    }
                    var qtyAvailable = 0;
                    var qtySold      = 0;
                    qtyAvailable = ItemSales.checkItemQuantity(setsales.getItemID());
                    qtySold      = ItemSales.checkItemQuantitySold(setsales.getItemID());
                    if (qtyAvailable <= qtySold)
                    {
                        throw new Exception("Item Selected is not available in Stock\nsales could not completed");
                    }
                    if (qtyAvailable < qtySold + setsales.GetQuantity())
                    {
                        throw new Exception("Quantity entered is greater than available Stock\nsales could not completed");
                    }
                    if (checkAddstudentName.Checked == true && NameID == null)
                    {
                        throw new Exception("Student name is NOT Selected");
                    }
                    if (string.IsNullOrEmpty(txtTotal.Text) | txtTotal.Text == "0")
                    {
                        throw new Exception("Total cost not provided Renter Quantity");
                    }
                    var discount = txtPercent.Text;
                    var NewQty   = qtyAvailable - (qtySold + setsales.GetQuantity());
                    ItemSales.makeSale(setsales.getItemID(), NewQty, setsales.GetQuantity().ToString(), txtAmount.Text, txtTotal.Text, dateTimeAdded, discount, 1, NameID);
                    Clear();
                    success = 10;
                    Infortimer.Start();
                }
                else
                {
                    //TO INSERT
                    setsales.SetQuantity(txtquantity.Text);
                    setsales.SetSellinPrice(txtSelingPrice.Text);
                    var qtyAvail = 0;
                    var qtySold  = 0;
                    if (setsales.getItemID() <= 0)
                    {
                        throw new Exception("Item Not found, Select and item");
                    }
                    qtyAvail = ItemSales.checkItemQuantity(setsales.getItemID());
                    qtySold  = ItemSales.checkItemQuantitySold(setsales.getItemID());
                    if (qtyAvail <= qtySold)
                    {
                        throw new Exception("Selected item is not available in Stock\nsales could not completed");
                    }
                    if (qtyAvail < qtySold + setsales.GetQuantity())
                    {
                        throw new Exception("Selected item Quantity is greater than available Stock\nsales could not completed");
                    }
                    if (checkAddstudentName.Checked == true && NameID == null)
                    {
                        throw new Exception("Student name is NOT Selected");
                    }
                    if (string.IsNullOrEmpty(txtTotal.Text) | txtTotal.Text == "0")
                    {
                        throw new Exception("Total cost not provided Renter Quantity");
                    }
                    var discount = txtPercent.Text;
                    var NewQty   = qtyAvail - (qtySold + setsales.GetQuantity());
                    ItemSales.makeSale(setsales.getItemID(), NewQty, setsales.GetQuantity().ToString(), txtAmount.Text, txtTotal.Text, dateTimeAdded, discount, 0, NameID);
                    Clear();
                    success = 10;
                    Infortimer.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sales Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #21
0
 public Sales_Record()
 {
     InitializeComponent();
     ItemSales.AllSales(dataGridSalesRecord, txtItemSearch.Text);
     ItemSales.ItemNames(combItemName);
 }
Beispiel #22
0
 private void dateTimeFrom_ValueChanged(object sender, EventArgs e)
 {
     dateSelect = true;
     ItemSales.AllSalesBetweenDate(dataGridSalesRecord, dateTimeFrom);
     lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal);
 }
Beispiel #23
0
 public Make_Sale()
 {
     InitializeComponent();
     ItemSales.DispayItems(dataGridItmes, "");
     ItemSales.DispayStudentNames(dataGridStudentNames, "");
 }
Beispiel #24
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     dateSelect = false;
     ItemSales.AllSales(dataGridSalesRecord, "");
 }