Exemplo n.º 1
0
 public static void insert_CTPN(ChiTietPNDTO ctpn)
 {
     try
     {
         cnn = DataProvider.ConnectData();
         string insert = string.Format("insert into db_chi_tiet_pn(ma_sp,ma_phieu_nhap,so_luong,gianhap,tong) values('{0}','{1}','{2}','{3}','{4}');",
                                       ctpn.ma_sp, ctpn.ma_phieu_nhap, ctpn.soluong, ctpn.gianhap, ctpn.tong);
         DataProvider.Execute(cnn, insert);
         cnn.Close();
     }catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public static void Update_CTPNSP(ChiTietPNDTO ctpn)
 {
     try
     {
         cnn = DataProvider.ConnectData();
         string update = string.Format("UPDATE db_chi_tiet_pn SET ma_sp='{1}',so_luong='{2}',gianhap='{3}',tong='{4}' WHERE id='{0}'",
                                       ctpn.id, ctpn.ma_sp, ctpn.soluong, ctpn.gianhap, ctpn.tong);
         DataProvider.Execute(cnn, update);
         cnn.Close();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        private void btnThemsp_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMaPN.Text == "")
                {
                    MessageBox.Show("Bạn chưa nhập mã phiếu !", "Thông báo");
                    txtMaPN.Focus();
                }
                else
                {
                    pnh.ma_phieu_nhap = txtMaPN.Text;
                    ChiTietPNDTO ctpn = new ChiTietPNDTO();
                    ctpn.ma_phieu_nhap = txtMaPN.Text;
                    ctpn.ma_sp         = txtMSP.Text;
                    ctpn.soluong       = int.Parse(txtSL.Text);
                    ctpn.gianhap       = double.Parse(txtGSP.Text);
                    ctpn.tong          = ctpn.soluong * ctpn.gianhap;

                    PhieuNhapBUS.Insert_CTPN(ctpn);
                    SanPhamDTO sp = new SanPhamDTO();
                    sp          = SanPhamBUS.Search_SP(ctpn.ma_sp);
                    sp.soluong  = sp.soluong + ctpn.soluong;
                    txtDVT.Text = sp.ma_loai;
                    SanPhamBUS.Update_SP(sp);
                    MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK);

                    TongTien = TongTien + ctpn.tong;
                    txtTongthanhtoan.Text = "" + TongTien + "";

                    load_data();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
 public static void Insert_CTPN(ChiTietPNDTO ctpn)
 {
     ChiTietPNDAO.insert_CTPN(ctpn);
 }
Exemplo n.º 5
0
 public static void Update_CTPN(ChiTietPNDTO ctpn)
 {
     ChiTietPNDAO.Update_CTPNSP(ctpn);
 }