Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ///Check Value

            if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dgvProducts.Rows.Count < 1 || txtDesOrder.Text == string.Empty)
            {
                MessageBox.Show("ينبغي تسجيل المعلومات المهمه", "تنبية", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ///إضافة معلومات الفاتورة
            order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), dtOrder.Value, Convert.ToInt32(txtCustomerID.Text), txtDesOrder.Text, txtSalesMan.Text);

            ///إضافة المنتجات المدخلة
            for (int i = 0; i < dgvProducts.Rows.Count - 1; i++)
            {
                order.ADD_ORDER_DETAILS(dgvProducts.Rows[i].Cells[0].Value.ToString(),
                                        Convert.ToInt32(txtOrderID.Text),
                                        Convert.ToInt32(dgvProducts.Rows[i].Cells[3].Value),
                                        dgvProducts.Rows[i].Cells[2].Value.ToString(),
                                        Convert.ToInt32(dgvProducts.Rows[i].Cells[5].Value),
                                        dgvProducts.Rows[i].Cells[4].Value.ToString(),
                                        dgvProducts.Rows[i].Cells[6].Value.ToString());
            }
            MessageBox.Show("تمت عملية الحفظ بنجاح", "عملية الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            ClearData();
        }
Exemple #2
0
        private void BTNSAVE_Click(object sender, EventArgs e)
        {
            if (TXTCUSTOMERID.Text == string.Empty || DGPRODUCTORDER.Rows.Count <= 1)
            {
                MessageBox.Show("يجب تسجيل البينات بالكامل ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            order.ADD_ORDER(Convert.ToInt32(TXTORDER.Text), DATETIMEORDER.Value, Convert.ToInt32(TXTCUSTOMERID.Text), TXTDESCRIPTION.Text, TXTSALESMANE.Text);

            for (int i = 0; i < DGPRODUCTORDER.Rows.Count - 1; i++)
            {
                order.ADD_ORDER_DETAILS(DGPRODUCTORDER.Rows[i].Cells[0].Value.ToString(),
                                        Convert.ToInt32(TXTORDER.Text),
                                        Convert.ToInt32(DGPRODUCTORDER.Rows[i].Cells[3].Value),
                                        DGPRODUCTORDER.Rows[i].Cells[2].Value.ToString(),
                                        Convert.ToInt32(DGPRODUCTORDER.Rows[i].Cells[5].Value),
                                        DGPRODUCTORDER.Rows[i].Cells[4].Value.ToString(),
                                        DGPRODUCTORDER.Rows[i].Cells[6].Value.ToString()
                                        );
            }


            //RPT.CrystalReport1 OrderReport = new RPT.CrystalReport1();
            //OrderReport.SetParameterValue("@id_order", Convert.ToInt32(TXTORDER.Text));
            //RPT.FRM_RPT frm = new RPT.FRM_RPT();
            //frm.crystalReportViewer1.ReportSource = OrderReport;
            //frm.ShowDialog();
            MessageBox.Show("تم الحفظ بنجاح", "حفظ", MessageBoxButtons.OK);
            ClearData();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (raOR.Checked == true)
                {
                    if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dataGridView1.Rows.Count < 1 ||
                        txtAmounKash.Text == string.Empty || txtAmounDue.Text == string.Empty || txtDescount.Text == string.Empty)
                    {
                        MessageBox.Show("BUUXI XOGTA MUHIMKA AH", "ISKA JIR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                else
                {
                    if (txtOrderID.Text == string.Empty || txtCustomerID.Text == string.Empty || dataGridView1.Rows.Count < 1 ||
                        txtAmounKash.Text == string.Empty || txtAmounDue.Text == string.Empty)
                    {
                        MessageBox.Show("BUUXI XOGTA MUHIMKA AH", "ISKA JIR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                int    IN_ID = Convert.ToInt32(lbTrID.Text);
                string AMD   = txtAmounDue.Text;
                string AMP   = txtAmounKash.Text;


                if (raOR.Checked == true)
                {
                    if (state == "add")
                    {
                        order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), Convert.ToInt32(txtDescount.Text),
                                        txtTotalAmount.Text, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text);
                    }
                    else
                    {
                        order.EDIT_ORDER(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), Convert.ToInt32(txtDescount.Text),
                                         txtTotalAmount.Text, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text);
                        FRM_ORDERS_LIST.getMainForm.dgvOrders.DataSource = order.SearchOrders2("");
                    }

                    /*
                     * else
                     * {
                     * // order.ADD_ORDER2(Convert.ToInt32(txtOrderID.Text), dtOrder.Value, txtSalesMan.Text, txtDesOrder.Text);
                     * order.ADD_ORDER(Convert.ToInt32(txtOrderID.Text), 33, dtOrder.Value, AMP, AMD, txtSalesMan.Text, txtDesOrder.Text);
                     * }*/
                }
                else
                {
                    if (state == "add")
                    {
                        order.ADD_Purchase_Orders(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), AMP, AMD, txtSalesMan.Text, txtDesOrder.Text);
                    }
                    else
                    {
                        order.EDIT_Purchase_Orders(Convert.ToInt32(txtOrderID.Text), Convert.ToInt32(txtCustomerID.Text), Convert.ToDateTime(dtOrder.Value.ToShortDateString()), AMP, AMD, txtSalesMan.Text, txtDesOrder.Text);
                        FRM_ORDERS_LIST.getMainForm.dgvOrders.DataSource = order.Search_Purchase_Orders("");
                    }
                }



                if (raOR.Checked == true)
                {
                    if (state == "add")
                    {
                        for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                        {
                            string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString();
                            int    ID_OR = Convert.ToInt32(txtOrderID.Text);
                            int    QTE   = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            string PRC   = dataGridView1.Rows[i].Cells[2].Value.ToString();
                            // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value);
                            string AM  = dataGridView1.Rows[i].Cells[4].Value.ToString();
                            string COS = dataGridView1.Rows[i].Cells[5].Value.ToString();

                            order.ADD_ORDER_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID, COS);
                            int    TR  = 2;
                            int    POR = 2;
                            string CR  = "OR";
                            int    Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            order.Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, POR, ID_OR, CR);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                        {
                            string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString();
                            int    ID_OR = Convert.ToInt32(txtOrderID.Text);
                            int    QTE   = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            string PRC   = dataGridView1.Rows[i].Cells[2].Value.ToString();
                            // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value);
                            string AM  = dataGridView1.Rows[i].Cells[4].Value.ToString();
                            string COS = dataGridView1.Rows[i].Cells[5].Value.ToString();

                            order.EDIT_ORDER_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID, COS);
                            int    TR  = 2;
                            int    POR = 2;
                            string CR  = "OR";
                            int    Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            order.EDIT_Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, POR, ID_OR, CR);
                        }
                    }
                }

                else
                {
                    if (state == "add")
                    {
                        for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                        {
                            string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString();
                            int    ID_OR = Convert.ToInt32(txtOrderID.Text);
                            int    QTE   = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            string PRC   = dataGridView1.Rows[i].Cells[2].Value.ToString();
                            // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value);
                            string AM = dataGridView1.Rows[i].Cells[4].Value.ToString();
                            // double TAM = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value);


                            order.ADD_Purchase_Order_Details(ID_OR, ID_PR, QTE, PRC, AM, dtOrder.Value, IN_ID);
                            int    TR  = 1;
                            int    POR = 2;
                            string CR  = "POR";
                            int    Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            order.Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, ID_OR, POR, CR);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                        {
                            string ID_PR = dataGridView1.Rows[i].Cells[0].Value.ToString();
                            int    ID_OR = Convert.ToInt32(txtOrderID.Text);
                            int    QTE   = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            string PRC   = dataGridView1.Rows[i].Cells[2].Value.ToString();
                            // float DIS = Convert.ToInt32(dataGridView1.Rows[i].Cells[5].Value);
                            string AM = dataGridView1.Rows[i].Cells[4].Value.ToString();
                            // double TAM = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value);


                            order.EDIT_Purchase_DETAILS(ID_OR, ID_PR, QTE, PRC, AM, IN_ID);
                            int    TR  = 1;
                            int    POR = 2;
                            string CR  = "POR";
                            int    Qty = Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value);
                            order.EDIT_Inventory_Transactions(IN_ID, TR, dtOrder.Value, ID_PR, Qty, ID_OR, POR, CR);
                        }
                    }
                }


                MessageBox.Show("waa lagu guuleestay kaydiska", "kaydis", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnNEW.Enabled = true;
            }
            catch
            {
                return;
            }
        }
 private void ADD_ORDER()
 {
     ORD.ADD_ORDER(ID_ORDER, ID_COUST, ORDER_NOTES, ORDER_TYPE, PAID_OR_NOT, SALES_MAN);
 }
Exemple #5
0
        private void ADD_ORDER()
        {
            string ORDER_NOTES = textBox_ORDER_NOTES.Text;

            ORD.ADD_ORDER(ID_ORDER, ID_COUST, ORDER_NOTES, ORDER_TYPE, PAID_OR_NOT, SALES_MAN);
        }