Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox9.Text != "Can't Create Invoice" && textBox10.Text != "")
            {
                DialogResult dr = MessageBox.Show("Confirm " + textBox1.Text + " Payment", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();

                    if (oR.CheckStatus == "Checked")
                    {
                        SalesTransaction sT = (from x in cheese.SalesTransactions where x.SalesTransactionID.Equals(textBox2.Text) select x).First();

                        sT.ConfirmBy              = _MainForm.userID;
                        sT.ConfirmDate            = DateTime.Now;
                        sT.SalesTransactionStatus = "Paid for " + textBox6.Text;
                        cheese.SaveChanges();
                        loadData();
                        dataGridView2.DataSource = null;
                        dataGridView3.DataSource = null;
                        clear();
                        btnDisabled();
                        MessageBox.Show("Payment Confirm");
                    }
                }
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox9.Text.Equals("Can't Create Invoice") == false && textBox10.Text != "")
            {
                DialogResult dr = MessageBox.Show("Sent " + textBox1.Text + " Invoice", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();

                    if (oR.CheckStatus != "Checked")
                    {
                        oR.CheckedBy   = _MainForm.userID;
                        oR.CheckedDate = DateTime.Now;
                        oR.CheckStatus = "Checked";
                        oR.OutgoingReportDescription = textBox10.Text;
                        cheese.SaveChanges();
                        loadData();
                        dataGridView2.DataSource = null;
                        dataGridView3.DataSource = null;
                        clear();
                        btnDisabled();
                        MessageBox.Show("Invoice Sent");
                    }
                }
            }
            else if (textBox10.Text == "")
            {
                label11.Text    = "Description is Empty";
                label11.Visible = true;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                DialogResult dr = MessageBox.Show("Create " + textBox1.Text + " Outgoing Report", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    Schedule s = (from x in cheese.Schedules where (x.ScheduleID.Equals(textBox3.Text) && x.SalesTransactionID.Equals(textBox2.Text)) where x.SalesTransactionID.Equals(textBox2.Text) select x).First();
                    if (s.ScheduleStatus == "Processed to Delivery")
                    {
                        s.ScheduleStatus = "Completed";
                        OutgoingReport oR = new OutgoingReport();
                        oR.OutgoingReportID   = textBox1.Text;
                        oR.SalesTransactionID = textBox2.Text;
                        oR.ScheduleID         = textBox3.Text;
                        oR.ShippedBy          = _MainForm.userID;
                        //oR.CheckedBy = "";
                        //oR.CheckedDate = null;
                        //oR.CheckStatus = "";
                        //oR.PackedBy = "";
                        //oR.OutgoingReportDescription = "";
                        oR.DeliveryStatus = "Sent";
                        cheese.OutgoingReports.Add(oR);
                        //cheese.SaveChanges();
                        cheese.SaveChanges();
                        loadData();
                        clear();
                        btnDisabled();
                        MessageBox.Show("Outgoing Report Created");
                        dataGridView2.DataSource = null;
                    }
                }
            }
        }
Example #4
0
        private void radioButton2_Click(object sender, EventArgs e)
        {
            label11.Visible = false;

            if (radioButton2.Checked == true && textBox1.Text != "")
            {
                Schedule       s  = (from x in cheese.Schedules where (x.ScheduleID.Equals(textBox3.Text)) select x).First();
                OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();

                textBox6.Text = dataGridView2.Rows[0].Cells[3].Value.ToString() + " Batch";
                textBox6.Text = dataGridView2.Rows[0].Cells[3].Value.ToString() + " Batch";
                if (s.ScheduleID.ToString().Equals(textBox6.Text))
                {
                    textBox7.Text = dataGridView3.Rows[0].Cells[1].Value.ToString();
                    int temp = (int)(Int32.Parse(dataGridView2.Rows[0].Cells[5].Value.ToString()) / Int32.Parse(dataGridView2.Rows[0].Cells[3].Value.ToString()));
                    textBox8.Text = temp.ToString();
                    int tempTotal = Int32.Parse(textBox7.Text) + Int32.Parse(textBox8.Text);
                    label9.Text = "Total Payment";
                    if (oR.CheckStatus == "Checked")
                    {
                        textBox10.Text = oR.OutgoingReportDescription;
                        btnEnabled(true);
                        SalesTransaction sT = (from x in cheese.SalesTransactions where (x.SalesTransactionID.Equals(textBox2.Text)) select x).First();
                        if (sT.SalesTransactionStatus != "Ongoing")
                        {
                            //btnDisabled();
                        }
                    }
                    else
                    {
                        btnEnabled(false);
                    }
                }
                else
                {
                    btnDisabled();
                    textBox9.Text = "Can't Create Invoice";
                    textBox7.Text = "";
                    textBox8.Text = "";
                    MessageBox.Show("Can't Created Invoice Yet, Batches " + s.BatchNumberSchedule + " From " + dataGridView2.Rows[0].Cells[3].Value.ToString());
                }
            }
        }
Example #5
0
        private void radioButton1_Click(object sender, EventArgs e)
        {
            label11.Visible = false;

            if (radioButton1.Checked == true && textBox1.Text != "")
            {
                Schedule       s  = (from x in cheese.Schedules where (x.ScheduleID.Equals(textBox3.Text)) select x).First();
                OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();

                if (dataGridView3.Rows.Count > 0)
                {
                    textBox6.Text = s.BatchNumberSchedule + " From " + dataGridView2.Rows[0].Cells[3].Value.ToString();
                }
                int temp = 0;
                foreach (DataGridViewRow row in dataGridView3.Rows)
                {
                    temp += Int32.Parse(row.Cells[1].Value.ToString());
                }
                textBox7.Text = temp.ToString();
                textBox8.Text = dataGridView2.Rows[0].Cells[5].Value.ToString();
                int tempTotal = Int32.Parse(textBox7.Text) + Int32.Parse(textBox8.Text);
                textBox9.Text = tempTotal.ToString();
                label9.Text   = "Batches Payment";
                if (oR.CheckStatus == "Checked")
                {
                    textBox10.Text = oR.OutgoingReportDescription;
                    btnEnabled(true);
                    SalesTransaction sT = (from x in cheese.SalesTransactions where (x.SalesTransactionID.Equals(textBox2.Text)) select x).First();
                    if (sT.SalesTransactionStatus != "Ongoing")
                    {
                        //btnDisabled();
                    }
                }
                else
                {
                    btnEnabled(false);
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                DialogResult dr = MessageBox.Show("Update " + textBox1.Text + " Delivery Status", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();
                    if (oR.DeliveryStatus == "Sent")
                    {
                        oR.DeliveryStatus = "Delivered";
                        cheese.SaveChanges();
                        loadData();
                        clear();
                        btnDisabled();
                        MessageBox.Show("Delivery Status Updated");
                        dataGridView2.DataSource = null;
                    }
                }
            }
        }
Example #7
0
        public void loadDetail()
        {
            var detailSalesTransaction = from x in cheese.DetailSalesTransactions
                                         where (x.SalesTransactionID.Equals(textBox2.Text))
                                         select new { x.CheeseID, x.ItemPrice, x.Quantity };

            dataGridView3.DataSource = detailSalesTransaction.ToList();

            Schedule       s  = (from x in cheese.Schedules where (x.ScheduleID.Equals(textBox3.Text)) select x).First();
            OutgoingReport oR = (from x in cheese.OutgoingReports where x.OutgoingReportID.Equals(textBox1.Text) select x).First();

            if (radioButton1.Checked == true)
            {
                if (dataGridView3.Rows.Count > 0)
                {
                    textBox6.Text = s.BatchNumberSchedule + " From " + dataGridView2.Rows[0].Cells[3].Value.ToString();
                }
                int temp = 0;
                foreach (DataGridViewRow row in dataGridView3.Rows)
                {
                    temp += Int32.Parse(row.Cells[1].Value.ToString());
                }
                textBox7.Text = temp.ToString();
                textBox8.Text = dataGridView2.Rows[0].Cells[5].Value.ToString();
                int tempTotal = Int32.Parse(textBox7.Text) + Int32.Parse(textBox8.Text);
                textBox9.Text = tempTotal.ToString();
                label9.Text   = "Batches Payment";
                if (oR.CheckStatus == "Checked")
                {
                    textBox10.Text = oR.OutgoingReportDescription;
                    btnEnabled(true);
                    SalesTransaction sT = (from x in cheese.SalesTransactions where (x.SalesTransactionID.Equals(textBox2.Text)) select x).First();
                    if (sT.SalesTransactionStatus != "Ongoing")
                    {
                        //btnDisabled();
                    }
                }
                else
                {
                    btnEnabled(false);
                }
            }
            else if (radioButton2.Checked == true)
            {
                textBox6.Text = dataGridView2.Rows[0].Cells[3].Value.ToString() + " Batch";
                if (s.ScheduleID.ToString().Equals(textBox6.Text))
                {
                    textBox7.Text = dataGridView3.Rows[0].Cells[1].Value.ToString();
                    int temp = (int)(Int32.Parse(dataGridView2.Rows[0].Cells[5].Value.ToString()) / Int32.Parse(dataGridView2.Rows[0].Cells[3].Value.ToString()));
                    textBox8.Text = temp.ToString();
                    int tempTotal = Int32.Parse(textBox7.Text) + Int32.Parse(textBox8.Text);
                    label9.Text = "Total Payment";
                    if (oR.CheckStatus == "Checked")
                    {
                        textBox10.Text = oR.OutgoingReportDescription;
                        btnEnabled(true);
                        SalesTransaction sT = (from x in cheese.SalesTransactions where (x.SalesTransactionID.Equals(textBox2.Text)) select x).First();
                        if (sT.SalesTransactionStatus != "Ongoing")
                        {
                            //btnDisabled();
                        }
                    }
                    else
                    {
                        btnEnabled(false);
                    }
                }
                else
                {
                    btnDisabled();
                    textBox9.Text = "Can't Create Invoice";
                    textBox7.Text = "";
                    textBox8.Text = "";
                    MessageBox.Show("Can't Created Invoice Yet, Batches " + s.BatchNumberSchedule + " From " + dataGridView2.Rows[0].Cells[3].Value.ToString());
                }
            }
        }