Exemplo n.º 1
0
        public void tsbtpxht(string a, Form1 F, DevExpress.XtraGrid.Views.Grid.GridView view, string roleid, string subsys, string ngaychungtu, string userid, string branchid, DataTable khach, DataTable hang, Boolean noibo)
        {
            try
            {
                Frm_phieudieuchinh u = new Frm_phieudieuchinh();
                if (noibo == false)
                {
                    u.myac = new Frm_phieudieuchinh.ac(F.refreshpxht);
                }
                else
                {
                    u.myac = new Frm_phieudieuchinh.ac(F.refreshpxhtnb);
                }
                u.getactive(a);
                u.getpt("pxht");
                u.getsub(subsys);
                u.getkhach(khach);
                u.gethang(hang);
                u.getroleid(roleid);
                u.getbranch(branchid);
                u.getnoibo(noibo);
                u.getuser(userid);
                u.getdate(ngaychungtu);

                if (a == "1")
                {
                    u.getrole(view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString());
                }
                else
                {
                    try
                    {
                        u.getrole(view.GetRowCellValue(view.FocusedRowHandle, "Mã kho").ToString());
                    }
                    catch
                    {
                        u.getrole(gen.GetString("select Top 1 StockCode from Stock where StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by StockCode"));
                    }
                }

                u.ShowDialog();
            }
            catch { MessageBox.Show("Vui lòng chọn phiếu nhập hàng thừa trước khi sửa."); }
        }
Exemplo n.º 2
0
 public void tsbtpnhtchuyen(string a, string ma, string roleid, string subsys, string ngaychungtu, string userid, string branchid, DataTable khach, DataTable hang)
 {
     try
     {
         Frm_phieudieuchinh u = new Frm_phieudieuchinh();
         u.getactive(a);
         u.getsub(subsys);
         u.gethang(hang);
         u.getkhach(khach);
         u.getroleid(roleid);
         u.getpt("pnht");
         u.getbranch(branchid);
         u.getuser(userid);
         u.getdate(ngaychungtu);
         u.getphieu(ma);
         u.ShowDialog();
     }
     catch { MessageBox.Show("Vui lòng chọn phiếu nhập hàng thừa trước khi sửa."); }
 }
Exemplo n.º 3
0
 public void checksau(string sct, int vt, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, Frm_phieudieuchinh F, string ngay, string mk)
 {
     try
     {
         string idkho = gen.GetString("select * from Stock where StockCode='" + mk + "'");
         tsbttruoc.Enabled = true;
         string id;
         if (vt == 0)
         {
             id = gen.GetString("select Top 1 * from INOutwardFree where RefNo > '" + sct + "' and Month(RefDate)='" + DateTime.Parse(ngay).Month.ToString() + "' and Year(RefDate)='" + DateTime.Parse(ngay).Year.ToString() + "' and StockID='" + idkho + "' order by RefNo ASC");
         }
         else
         {
             id = gen.GetString("select Top 1 * from INOutwardFree where RefNo > '" + sct + "' and Month(RefDate)='" + DateTime.Parse(ngay).Month.ToString() + "' and Year(RefDate)='" + DateTime.Parse(ngay).Year.ToString() + "' and StockID='" + idkho + "' order by RefNo DESC");
             tsbtsau.Enabled = false;
         }
         F.getrole(id);
     }
     catch
     {
         tsbtsau.Enabled = false;
     }
 }
Exemplo n.º 4
0
 //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void checkpxht(string active, string role, Frm_phieudieuchinh F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, TextEdit txtsct, TextEdit txtname,
                       TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                       ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, string userid, string branchid, TextEdit txtms)
 {
     try
     {
         string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
         string[,] detail = new string[20, 8];
         string check = "0";
         for (int i = 0; i < gridView1.RowCount - 1; i++)
         {
             if (gridView1.GetRowCellValue(i, "Tài khoản có").ToString() == "")
             {
                 check = "1";
             }
             detail[i, 0] = gridView1.GetRowCellValue(i, "Tài khoản có").ToString();
             if (gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString() == "")
             {
                 check = "1";
             }
             detail[i, 1] = gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString();
             if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
             {
                 check = "1";
             }
             else
             {
                 string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                 detail[i, 2] = mh;
             }
             if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
             {
                 detail[i, 3] = "0";
             }
             else
             {
                 detail[i, 3] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
             }
             if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
             {
                 detail[i, 4] = "0";
             }
             else
             {
                 detail[i, 4] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
             }
             if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
             {
                 detail[i, 5] = "0";
             }
             else
             {
                 detail[i, 5] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
             }
             if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() == "")
             {
                 detail[i, 6] = "0";
             }
             else
             {
                 detail[i, 6] = gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
             }
         }
         if (check == "1")
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Tài khoản có> <Tài khoản nợ> <Mã hàng> <Số lượng> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
             string tong = gridView1.Columns["Thành tiền"].SummaryText.Replace(".", "");
             if (active == "0")
             {
                 try
                 {
                     string ton = gen.GetString("select * from INOutwardFree where RefNo='" + txtsct.Text + "'");
                     themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid);
                     XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 catch { }
                 gen.ExcuteNonquery("insert into INOutwardFree(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,JournalMemo,Posted,StockID,TotalAmount,InvSeries,InvNo,InvDate,EmployeeID,No) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtldn.Text + "','False','" + dv + "','" + tong + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + txtnhd.EditValue.ToString() + "','" + userid + "','" + txtms.Text + "')");
                 string refid = gen.GetString("select * from INOutwardFree where RefNo='" + txtsct.Text + "'");
                 F.getrole(refid);
                 for (int i = 0; i < gridView1.RowCount - 1; i++)
                 {
                     gen.ExcuteNonquery("insert into INOutwardFreeDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "')");
                 }
             }
             else
             {
                 gen.ExcuteNonquery("update INOutwardFree set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',JournalMemo=N'" + txtldn.Text + "',StockID='" + dv + "',TotalAmount='" + tong + "',Posted='False',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "',EmployeeID='" + userid + "',No='" + txtms.Text + "'  where RefID='" + role + "'");
                 gen.ExcuteNonquery("delete  from  INOutwardFreeDetail where RefID='" + role + "'");
                 for (int i = 0; i < gridView1.RowCount - 1; i++)
                 {
                     gen.ExcuteNonquery("insert into INOutwardFreeDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "')");
                 }
             }
             F.myac();
             F.getactive("1");
             F.Text = "Xem phiếu xuất hàng khuyến mãi";
         }
     }
     catch
     {
         XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 5
0
        public void loadpxht(string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                             DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit tkno, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit tkco, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang,
                             DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, Frm_phieudieuchinh F, LookUpEdit ledt, TextEdit txtldn,
                             ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string tsbt, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, TextEdit txtcth, string userid, string branchid, TextEdit txtms, DataTable khach, DataTable hang, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rpmanganh, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rpmachiphi)
        {
            DataTable          dt   = new DataTable();
            phieunhapdieuchinh pndc = new phieunhapdieuchinh();

            pndc.loadstart(gridControl1, gridView1, ledv, denct, denht, tkno, tkco, mahang, soluong, soluongqd, dongia, thanhtien, ledt, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, dt, tsbt, userid, khach, hang, rpmanganh, rpmachiphi);
            if (active == "1")
            {
                DataTable da = new DataTable();
                da = gen.GetTable("select  DebitAccount,CreditAccount,Amount,InventoryItemCode,a.UnitPrice,Quantity,QuantityConvert from INOutwardFreeDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = da.Rows[i][0].ToString();
                    dr[1] = da.Rows[i][1].ToString();
                    dr[2] = da.Rows[i][3].ToString();
                    dr[3] = da.Rows[i][5].ToString();
                    dr[4] = da.Rows[i][6].ToString();
                    dr[5] = da.Rows[i][4].ToString();
                    dr[6] = da.Rows[i][2].ToString();
                    dt.Rows.Add(dr);
                }
                gridControl1.DataSource = dt;
                tsbtcat.Enabled         = false;

                F.Text = "Xem phiếu xuất hàng khuyến mãi";
                da     = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,Tax,InvDate,InvSeries,InvNo,No  from INOutwardFree a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + role + "'");

                ledv.EditValue   = da.Rows[0][7].ToString();
                ledt.EditValue   = da.Rows[0][0].ToString();
                txtldn.Text      = da.Rows[0][2].ToString();
                denct.EditValue  = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue  = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.EditValue = da.Rows[0][6].ToString();
                txtshd.Text      = da.Rows[0][14].ToString();
                txtms.Text       = da.Rows[0][15].ToString();
                try
                {
                    txtnhd.EditValue = DateTime.Parse(da.Rows[0][12].ToString());
                }
                catch { txtnhd.Text = ""; }
                txtkhhd.Text = da.Rows[0][13].ToString();
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }
                txtcth.Text = gridView1.Columns["Thành tiền"].SummaryText;
            }
            else
            {
                /*try
                 * {*/
                F.Text = "Thêm phiếu xuất hàng khuyến mãi";
                if (role == null)
                {
                    ledv.ItemIndex = 0;
                }
                else
                {
                    ledv.EditValue = role;
                }
                denct.EditValue  = DateTime.Parse(ngaychungtu);
                denht.EditValue  = DateTime.Parse(ngaychungtu);
                txtnhd.EditValue = DateTime.Parse(ngaychungtu);
                txtcth.Text      = gridView1.Columns["Thành tiền"].SummaryText;

                /*}
                 * catch
                 * {
                 *  XtraMessageBox.Show("Vui lòng kiểm tra lại < Ngày chứng từ >.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 *  F.Close();
                 * }*/
            }
        }
Exemplo n.º 6
0
        //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void checkpxht(string active, string role, Frm_phieudieuchinh F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, TextEdit txtsct, TextEdit txtname,
                              TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                              ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, string userid, string branchid, TextEdit txtms, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, Boolean noibo, TextEdit txtthuesuat, CheckEdit cghd)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail = new string[50, 15];
                string check = "0";
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Tài khoản có").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 0] = gridView1.GetRowCellValue(i, "Tài khoản có").ToString();
                    if (gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 1] = gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString();
                    if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        detail[i, 2] = mh;
                    }
                    if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
                    {
                        detail[i, 3] = "0";
                    }
                    else
                    {
                        detail[i, 3] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    }
                    if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
                    {
                        detail[i, 4] = "0";
                    }
                    else
                    {
                        detail[i, 4] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
                    }
                    if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
                    {
                        detail[i, 5] = "0";
                    }
                    else
                    {
                        detail[i, 5] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
                    }
                    if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() == "")
                    {
                        detail[i, 6] = "0";
                    }
                    else
                    {
                        detail[i, 6] = gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
                    }

                    detail[i, 7] = gridView1.GetRowCellValue(i, "Mã ngành").ToString();
                    detail[i, 8] = gridView1.GetRowCellValue(i, "Nhóm chi phí").ToString();

                    detail[i, 9]  = gridView1.GetRowCellValue(i, "Ca").ToString();
                    detail[i, 10] = gridView1.GetRowCellValue(i, "Tài xế").ToString();
                    detail[i, 11] = gridView1.GetRowCellValue(i, "Số xe").ToString();

                    if (gridView1.GetRowCellValue(i, "Số KM").ToString() == "")
                    {
                        detail[i, 12] = "0";
                    }
                    else
                    {
                        detail[i, 12] = gridView1.GetRowCellValue(i, "Số KM").ToString().Replace(".", "").Replace(",", ".");
                    }
                }
                if (check == "1")
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Tài khoản có> <Tài khoản nợ> <Mã hàng> <Số lượng> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    string tong = gridView1.Columns["Thành tiền"].SummaryText.Replace(".", "");
                    if (active == "0")
                    {
                        try
                        {
                            string ton = gen.GetString("select * from OUTdeficit where RefNo='" + txtsct.Text + "'");
                            themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid, tsbttruoc, tsbtsau, noibo);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }
                        gen.ExcuteNonquery("insert into OUTdeficit(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,JournalMemo,Posted,StockID,TotalAmount,InvSeries,InvNo,InvDate,EmployeeID,No,Cancel,Tax,IsExport) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtldn.Text + "','False','" + dv + "','" + tong + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + txtnhd.EditValue.ToString() + "','" + userid + "','" + txtms.Text + "','" + noibo + "','" + txtthuesuat.EditValue + "','" + cghd.Checked + "')");
                        string refid = gen.GetString("select * from OUTdeficit where RefNo='" + txtsct.Text + "'");
                        F.getrole(refid);
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into OUTdeficitDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert,Description,CustomField5,Ca,Taixe,Soxe,Sokm) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "','" + detail[i, 7] + "','" + detail[i, 8] + "',N'" + detail[i, 9] + "',N'" + detail[i, 10] + "','" + detail[i, 11] + "','" + detail[i, 12] + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,Occupation,GroupCost) values(newid(),'" + refid + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + detail[i, 7] + "','" + detail[i, 8] + "')");
                        }
                    }
                    else
                    {
                        gen.ExcuteNonquery("update OUTdeficit set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',JournalMemo=N'" + txtldn.Text + "',StockID='" + dv + "',TotalAmount='" + tong + "',Posted='False',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "',EmployeeID='" + userid + "',No='" + txtms.Text + "', Cancel='" + noibo + "', Tax='" + txtthuesuat.EditValue + "',IsExport='" + cghd.Checked + "'  where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete  from  OUTdeficitDetail where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete HACHTOAN where RefID='" + role + "'");
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into OUTdeficitDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert,Description,CustomField5,Ca,Taixe,Soxe,Sokm) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "','" + detail[i, 7] + "','" + detail[i, 8] + "',N'" + detail[i, 9] + "',N'" + detail[i, 10] + "','" + detail[i, 11] + "','" + detail[i, 12] + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,Occupation,GroupCost) values(newid(),'" + role + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + detail[i, 7] + "','" + detail[i, 8] + "')");
                        }
                    }
                    F.myac();
                    F.getactive("1");
                    F.Text = "Xem phiếu xuất hàng thừa";
                }
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
 public Form getPDC(Frm_phieudieuchinh a)
 {
     PDC = a;
     return(PDC);
 }