Exemple #1
0
        // Variable pass for Salesdetails
        private void datagrdReportDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (lblENDdate.Text == "0")
                {
                    DataGridViewRow row      = datagrdReportDetails.Rows[e.RowIndex];
                    string          id       = row.Cells[0].Value.ToString();
                    double          Payamt   = Convert.ToDouble(row.Cells[2].Value.ToString());
                    double          vat      = Convert.ToDouble(row.Cells[5].Value.ToString());
                    double          subtotal = Convert.ToDouble(row.Cells[2].Value.ToString()) - Convert.ToDouble(vat);
                    double          dis      = Convert.ToDouble(row.Cells[4].Value.ToString());

                    if (row.Cells[6].Value.ToString() == "Invoice")
                    {
                        // Inventory.InvoicePrint go = new Inventory.InvoicePrint(id);
                        View_Sales_invoice go = new View_Sales_invoice(id);
                        go.ShowDialog();
                    }
                    else
                    {
                        SalesDetails go = new SalesDetails(id, dis, subtotal, vat, Payamt);
                        go.ShowDialog();
                    }
                }
            }
            catch // (Exception exp)
            {
                // MessageBox.Show("Sorry" + exp.Message);
            }
        }
        // Save and Complete Sales
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to Complete Sale and Print?  ", "Yes or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                if (lblTotal.Text == "0")
                {
                    MessageBox.Show("Sorry ! you have not enough product \n  Please Purchase product or Increase Product Quantity");
                }
                //else if (Convert.ToInt32(txtinvoiceNo.Text) >= 53)  //Please uncommet this section
                //{
                //    MessageBox.Show("Sorry ! Demo version has limited transaction \n Please buy it \n contact at : [email protected]", "Yes or No", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                //}
                else if (CmbWarehouse.Text == string.Empty)
                {
                    MessageBox.Show("Please Select WareHouse .. ");
                    CmbWarehouse.Focus();
                }
                else
                {
                    try
                    {
                        //Save payment info into 'sales_payment' table
                        payment_item();

                        //Save Sales item into 'sales_item' table
                        sales_item();

                        //Save Sale info into 'tbl_saleInfo' table
                        SaleInfo();

                        // 5 % Rewards Point add to customer Account for total Payable amount
                        //  AddCredit();

                        // Inventory.InvoicePrint go = new Inventory.InvoicePrint(txtinvoiceNo.Text);
                        View_Sales_invoice go = new View_Sales_invoice(txtinvoiceNo.Text);
                        go.ShowDialog();

                        ShowSales_id_increment();
                        ClearForm2();
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show(exp.Message);
                    }
                }
            }
        }