Beispiel #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("product_code");
            dt.Columns.Add("product_name");
            dt.Columns.Add("parcode");
            dt.Columns.Add("sell_price");

            foreach (DataRow item in dt_prodcuts.Rows)
            {
                if (Convert.ToBoolean(item["select_"].ToString()) != true)
                {
                    continue;
                }
                decimal number = decimal.Parse(item["avialble_qty"].ToString());
                DataRow addrow;
                for (int i = 0; i < number; i++)
                {
                    addrow = dt.NewRow();
                    addrow["product_code"] = item["product_code"].ToString();
                    addrow["product_name"] = item["product_name"].ToString();
                    addrow["parcode"]      = item["parcode"].ToString();
                    addrow["sell_price"]   = item["sell_price"].ToString();
                    dt.Rows.Add(addrow);
                }
            }
            switch (comboBoxEdit1.Text)
            {
            case "style one":
                ROSESONLY.reports.rpt_parcodeprint rpt = new reports.rpt_parcodeprint();
                rpt.DataSource = dt;
                frm_showreports frm = new frm_showreports();
                frm.documentViewer1.DocumentSource = rpt;
                frm.ShowDialog();
                break;

            case "style two":
                ROSESONLY.reports.rpt_prarcodstyle2 rpt1 = new reports.rpt_prarcodstyle2();
                rpt1.DataSource = dt;
                frm_showreports frm1 = new frm_showreports();
                frm1.documentViewer1.DocumentSource = rpt1;
                frm1.ShowDialog();
                break;

            case "style three":
                ROSESONLY.reports.rpt_style3 rpt3 = new reports.rpt_style3();
                rpt3.DataSource = dt;
                frm_showreports frm3 = new frm_showreports();
                frm3.documentViewer1.DocumentSource = rpt3;
                frm3.ShowDialog();
                break;

            case "one barcode":
                ROSESONLY.reports.rpt_barcode rpt4 = new reports.rpt_barcode();
                rpt4.DataSource = dt;
                frm_showreports frm4 = new frm_showreports();
                frm4.documentViewer1.DocumentSource = rpt4;
                frm4.ShowDialog();
                break;
            }
        }
Beispiel #2
0
        private void simpleButton12_Click_1(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "تسوية مخزن", "add_new", 1) == false)
            {
                return;
            }

            gridView1.ActiveFilter.Clear();

            if (gridView1.RowCount == 0)
            {
                MSg.showmsg("لا يمكن حفظ فاتورة شراء خالية من الأصناف", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }
            #region addnew invoice.....
            if (addnew == true)
            {
                SqlParameter[] param = new SqlParameter[7];
                param[0] = new SqlParameter("@move_type", "تسوية");
                param[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
                param[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
                param[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
                param[4] = new SqlParameter("@user_id", connectiondata.user_id);
                param[5] = new SqlParameter("@purchasetable", dt_products);
                param[6] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
                cd.runproc("sp_Adjustinsert", param);
                MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
                binding_navigations();
                bindingsearch();
                //print invoicedata
                SqlParameter[] para = new SqlParameter[2];
                para[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
                para[1] = new SqlParameter("@invoice_type", "تسوية");
                DataTable dt_r = new DataTable();
                dt_r = cd.getdata("rpt_purchaseInvoicePrint", para);
                ROSESONLY.reports.rpt_purchaseInvoice rpt = new reports.rpt_purchaseInvoice();
                rpt.DataSource = dt_r;
                frm_showreports frm1 = new frm_showreports();
                frm1.documentViewer1.DocumentSource = rpt;
                frm1.ShowDialog();
                cleardata();
                gridControl2.Visible = false;

                return;
            }
            #endregion
            #region update invoice.....
            SqlParameter[] param1 = new SqlParameter[7];
            param1[0] = new SqlParameter("@move_type", "تسوية");
            param1[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
            param1[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
            param1[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
            param1[4] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
            param1[5] = new SqlParameter("@purchasetable", dt_products);
            int rowno = navigations_view.FocusedRowHandle;
            param1[6] = new SqlParameter("@move_no", navigations_view.GetRowCellValue(rowno, "move_no").ToString());
            cd.runproc("sp_AdjustUpdate", param1);

            MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
            //print invoicedata
            SqlParameter[] pam = new SqlParameter[2];
            pam[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
            pam[1] = new SqlParameter("@invoice_type", "تسوية");
            DataTable dt_r1 = new DataTable();
            dt_r1 = cd.getdata("rpt_purchaseInvoicePrint", pam);
            ROSESONLY.reports.rpt_purchaseInvoice rpt1 = new reports.rpt_purchaseInvoice();
            rpt1.DataSource = dt_r1;
            frm_showreports frm2 = new frm_showreports();
            frm2.documentViewer1.DocumentSource = rpt1;
            frm2.ShowDialog();

            cleardata();
            addnew = true;
            gridControl2.Visible = false;
            cmb_stores.Enabled   = true;

            #endregion
        }