コード例 #1
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "الخزينة", "change_date", 1) == false)
            {
                return;
            }

            frm_cashierconvert frm = new frm_cashierconvert();

            frm.ShowDialog();
        }
コード例 #2
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "الخزينة", "edit_", 1) == false)
            {
                return;
            }

            if (gridView1.RowCount == 0)
            {
                return;
            }
            FormCollection fc = Application.OpenForms;

            switch (gridView1.GetFocusedRowCellValue("invoice_type").ToString())
            {
            case "شراء":
                foreach (Form item in fc)
                {
                    if (item.Text == "شراء")
                    {
                        frm_purchase.get_main.Close();
                        break;
                    }
                }
                frm_purchase.get_main.m_value = returnmovenumber(int.Parse(gridView1.GetFocusedRowCellValue("invoice_no").ToString()), gridView1.GetFocusedRowCellValue("invoice_type").ToString());
                frm_othermain.getmain.openform(frm_purchase.get_main);
                break;

            case "بيع":
                foreach (Form item in fc)
                {
                    if (item.Text == "فاتورة بيع")
                    {
                        frm_SalesInvoice.get_main.Close();
                        break;
                    }
                }
                frm_SalesInvoice.get_main.m_value = returnmovenumber(int.Parse(gridView1.GetFocusedRowCellValue("invoice_no").ToString()), gridView1.GetFocusedRowCellValue("invoice_type").ToString());
                frm_othermain.getmain.openform(frm_SalesInvoice.get_main);
                break;

            case "مرتجع شراء":
                foreach (Form item in fc)
                {
                    if (item.Text == "مرتجع شراء")
                    {
                        frm_purchaseReturn.get_main.Close();
                        break;
                    }
                }
                frm_purchaseReturn.get_main.m_value = returnmovenumber(int.Parse(gridView1.GetFocusedRowCellValue("invoice_no").ToString()), gridView1.GetFocusedRowCellValue("invoice_type").ToString());
                frm_othermain.getmain.openform(frm_purchaseReturn.get_main);
                break;

            case "مرتجع بيع":
                foreach (Form item in fc)
                {
                    if (item.Text == "مرتجع بيع")
                    {
                        frm_salesreturn.get_main.Close();
                        break;
                    }
                }
                frm_salesreturn.get_main.m_value = returnmovenumber(int.Parse(gridView1.GetFocusedRowCellValue("invoice_no").ToString()), gridView1.GetFocusedRowCellValue("invoice_type").ToString());
                frm_othermain.getmain.openform(frm_salesreturn.get_main);
                break;

            case "تحويلات خزينة":
                SqlParameter[] para = new SqlParameter[1];
                int            code = int.Parse(gridView1.GetFocusedRowCellValue("transfer_code").ToString());
                para[0] = new SqlParameter("@transfer_code", code);
                DataTable dt1 = new DataTable();
                dt1 = cd.getdata("sp_returnTransferData", para);
                frm_cashierconvert frm1 = new frm_cashierconvert();
                frm1.txt_date.Text          = Convert.ToDateTime(dt1.Rows[0]["move_date"]).ToString("d");
                frm1.txt_value.Text         = dt1.Rows[0]["credit_value"].ToString();
                frm1.cmb_cashier1.EditValue = dt1.Rows[0]["cashier1"].ToString();
                frm1.cmb_cashier2.EditValue = dt1.Rows[0]["cashier2"].ToString();
                frm1.transfer_code          = code;
                frm1.btn_saveexit.Tag       = 1;
                frm1.ShowDialog();
                break;

            default:
                int    rowindex   = gridView1.FocusedRowHandle;
                string invoice_no = gridView1.GetRowCellValue(rowindex, "invoice_no").ToString();
                int    move_no    = int.Parse(gridView1.GetRowCellValue(rowindex, "move_no").ToString());
                string move_type  = gridView1.GetRowCellValue(rowindex, "move_type").ToString();

                if (invoice_no != "0")
                {
                }
                else
                {
                    SqlParameter[] p = new SqlParameter[2];
                    p[0] = new SqlParameter("@move_no", move_no);
                    p[1] = new SqlParameter("@move_type", move_type);
                    DataTable dt_ = new DataTable();
                    dt_ = cd.getdata("sp_cashierreturn", p);
                    //frm_cashierupdate frm = new frm_cashierupdate();
                    int accountcode;
                    if (move_type == "صادر")
                    {
                        frm_cashierout frm = new frm_cashierout();
                        frm.txt_value.Text         = gridView1.GetRowCellValue(rowindex, "creadit_value").ToString();
                        accountcode                = int.Parse(gridView1.GetRowCellValue(rowindex, "account_code").ToString());
                        frm.txt_date.Text          = Convert.ToDateTime(gridView1.GetRowCellValue(rowindex, "move_date").ToString()).ToString("d");
                        frm.cmb_accounts.EditValue = accountcode;
                        frm.cmb_cashier.EditValue  = cmb_cashier.EditValue;
                        frm.txt_band.Text          = gridView1.GetRowCellValue(rowindex, "band").ToString();
                        frm.txt_notes.Text         = gridView1.GetRowCellValue(rowindex, "notes").ToString();
                        frm.cmb_accounts.Focus();
                        frm.btn_ok.Tag = "1";
                        frm.move_no    = move_no;
                        frm_othermain.getmain.openform(frm);
                    }
                    else
                    {
                        frm_cashieradd frm = new frm_cashieradd();
                        frm.txt_value.Text         = gridView1.GetRowCellValue(rowindex, "debit_value").ToString();
                        accountcode                = int.Parse(gridView1.GetRowCellValue(rowindex, "account_code").ToString());
                        frm.txt_date.Text          = Convert.ToDateTime(gridView1.GetRowCellValue(rowindex, "move_date").ToString()).ToString("d");
                        frm.cmb_accounts.EditValue = accountcode;
                        frm.cmb_cashier.EditValue  = cmb_cashier.EditValue;
                        frm.txt_band.Text          = gridView1.GetRowCellValue(rowindex, "band").ToString();
                        frm.txt_notes.Text         = gridView1.GetRowCellValue(rowindex, "notes").ToString();
                        frm.move_no                = move_no;
                        frm.btn_ok.Tag             = "1";
                        frm.cmb_accounts.Focus();
                        frm_othermain.getmain.openform(frm);
                    }
                }
                break;
            }
        }