Beispiel #1
0
 private void button5_Click_1(object sender, EventArgs e)
 {
     using (ReceiptForm form = new ReceiptForm(noTxt.Text))
     {
         DialogResult dr = form.ShowDialog();
         if (dr == DialogResult.OK)
         {
             //  LoadData();
         }
     }
 }
Beispiel #2
0
        private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0)
            {
                if (selectedIDs.Contains(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()))
                {
                    selectedIDs.Remove(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                }
                else
                {
                    selectedIDs.Add(dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["View"].Index && e.RowIndex >= 0)
            {
                using (ReceiptForm form = new ReceiptForm(dtGrid.Rows[e.RowIndex].Cells["No"].Value.ToString()))
                {
                    DialogResult dr = form.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        //  LoadData();
                    }
                }
            }
            if (e.ColumnIndex == dtGrid.Columns["Check"].Index && e.RowIndex >= 0)
            {
                using (ReceiptForm form = new ReceiptForm(dtGrid.Rows[e.RowIndex].Cells["No"].Value.ToString()))
                {
                    DialogResult dr = form.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        //  LoadData();
                    }
                }
            }
            try
            {
                if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0)
                {
                    if (MessageBox.Show("YES or No?", "Are you sure you want to delete this Invoice? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        string Query = "DELETE from invoice WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString() + "'";
                        MySQL.Query(Query);
                        Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(MySQL.Insert(Query)), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(q);
                        MessageBox.Show("Information deleted");
                        LoadData();
                    }
                }
            }
            catch { }
        }
Beispiel #3
0
        private void GenerateInvoice()
        {
            foreach (CaseTransaction t in GenericCollection.caseTransactions)
            {
                string          ids = Guid.NewGuid().ToString();
                CaseTransaction c   = new CaseTransaction(ids, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, t.ItemID, noTxt.Text, t.DeliveryID, t.Qty, t.Cost, t.Units, t.Total, t.Tax, t.Coverage, t.Self, t.Payable, t.Limits, t.Setting, t.Period, t.Height, t.Weight, t.Instruction, t.Created, "false", Helper.CompanyID);
                if (MySQL.Insert(c) != "")
                {
                }
            }
            //string Pid = Guid.NewGuid().ToString();
            //Payment p = new Payment(Pid, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, typeCbx.Text, methodCbx.Text, Convert.ToDouble(amountTxt.Text), Convert.ToDouble(balanceTxt.Text), DateTime.Now.ToString("dd-MM-yyyy H:m:s"), "false", Helper.CompanyID);
            //MySQL.Insert(p);


            using (ReceiptForm form = new ReceiptForm(noTxt.Text))
            {
                DialogResult dr = form.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    //  LoadData();
                }
            }
        }
Beispiel #4
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(amountTxt.Text))
            {
                amountTxt.BackColor = Color.Red;
                MessageBox.Show("How much is being paid ? ");
                return;
            }
            if (GenericCollection.caseTransactions.Count < 1)
            {
                MessageBox.Show("No Products Defined !");
                return;
            }
            if (string.IsNullOrEmpty(categoryCbx.Text))
            {
                categoryCbx.BackColor = Color.Red;
                MessageBox.Show("How much is being paid ? ");
                return;
            }
            if (string.IsNullOrEmpty(typeCbx.Text))
            {
                typeCbx.BackColor = Color.Red;
                MessageBox.Show("How much is being paid ? ");
                return;
            }
            taxTxt.Text    = string.IsNullOrEmpty(taxTxt.Text) ? "0" : taxTxt.Text;
            amountTxt.Text = string.IsNullOrEmpty(amountTxt.Text) ? "0" : amountTxt.Text;
            methodCbx.Text = string.IsNullOrEmpty(methodCbx.Text) ? "none" : "none";

            string  Iid  = Guid.NewGuid().ToString();
            Invoice i    = new Invoice(Iid, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, typeCbx.Text, categoryCbx.Text, VendorID, CustomerID, methodCbx.Text, Total, termsTxt.Text, Convert.ToDouble(taxTxt.Text), Convert.ToDouble(amountTxt.Text), Convert.ToDouble(balanceTxt.Text), Convert.ToDouble(amountTxt.Text), Convert.ToInt32(ItemCountTxt.Text), Helper.UserID, DateTime.Now.ToString("dd-MM-yyyy H:m:s"), "false", Helper.CompanyID);
            string  save = MySQL.Insert(i);

            if (save != "")
            {
                Queries q = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(save), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                MySQL.Insert(q);
                foreach (CaseTransaction t in GenericCollection.caseTransactions)
                {
                    CaseTransaction c     = new CaseTransaction(t.Id, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, t.ItemID, "", "", t.Qty, t.Cost, t.Units, t.Total, t.Tax, t.Coverage, t.Self, t.Payable, t.Limits, t.Setting, t.Period, t.Height, t.Weight, t.Instruction, t.Created, "false", Helper.CompanyID);
                    string          saves = MySQL.Insert(c);
                    if (saves != "")
                    {
                        Queries qe = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(saves), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                        MySQL.Insert(qe);
                    }
                }

                string  Pid   = Guid.NewGuid().ToString();
                Payment p     = new Payment(Pid, Convert.ToDateTime(dateTxt.Text).ToString("dd-MM-yyyy"), noTxt.Text, typeCbx.Text, methodCbx.Text, Convert.ToDouble(amountTxt.Text), Convert.ToDouble(balanceTxt.Text), DateTime.Now.ToString("dd-MM-yyyy H:m:s"), "false", Helper.CompanyID);
                string  saved = MySQL.Insert(p);
                if (saved != "")
                {
                    Queries qr = new Queries(Guid.NewGuid().ToString(), Helper.UserName, Helper.CleanString(saved), "false", DateTime.Now.ToString("dd-MM-yyyy H:m:s"), Helper.CompanyID);
                    MySQL.Insert(qr);
                }
            }
            using (ReceiptForm form = new ReceiptForm(noTxt.Text))
            {
                DialogResult dr = form.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    //  LoadData();
                }
            }

            button3.Visible = false;
        }