private void show_DV() { lsvDV.Items.Clear(); tiendichvu = 0; ptpBUS = new PhieuThuePhongBUS(); PhieuThuePhongDTO ptp = ptpBUS.getPhieuThuePhongByID(cmbMaPT.Text); cttpBUS = new ChiTietThuePhongBUS(); IList <ChiTietThuePhongDTO> listcttp = cttpBUS.getChiTietThuePhongByID(ptp.Maphieuthue); dvBUS = new DichVuBUS(); foreach (ChiTietThuePhongDTO cttp in listcttp) { int i = lsvDV.Items.Count; DichVuDTO dv = dvBUS.getDichVuByID(cttp.Madichvu); lsvDV.Items.Add(dv.Tendichvu); lsvDV.Items[i].SubItems.Add(cttp.Maphong); lsvDV.Items[i].SubItems.Add(cttp.Ngay.ToShortDateString()); lsvDV.Items[i].SubItems.Add(cttp.Ngay.ToLongTimeString()); lsvDV.Items[i].SubItems.Add(dv.Gia.ToString("0,0")); lsvDV.Items[i].SubItems.Add(cttp.Soluong.ToString()); decimal tt = dv.Gia * cttp.Soluong; lsvDV.Items[i].SubItems.Add(tt.ToString("0,0")); tiendichvu += tt; } labTDV.Text = tiendichvu.ToString("0,0"); }
private void show_CTTP() { lsvCTPT.Items.Clear(); decimal t = 0; txtTongTien.Clear(); dtpNgayGio.Enabled = false; dtpNgayGio.Format = DateTimePickerFormat.Custom; dtpNgayGio.CustomFormat = "dd/MM/yyyy h:mm:ss"; dtpNgayGio.Value = DateTime.Now; string fePT = cmbMaPT.SelectedItem.ToString(); cttpBUS = new ChiTietThuePhongBUS(); IList <ChiTietThuePhongDTO> listcttp = cttpBUS.getChiTietThuePhongByID(fePT); foreach (ChiTietThuePhongDTO cttp in listcttp) { int i = lsvCTPT.Items.Count; if (cmbMaphong.Text != "") { if (cttp.Maphong == cmbMaphong.SelectedItem.ToString()) { dvBUS = new DichVuBUS(); DichVuDTO listdv = dvBUS.getDichVuByID(cttp.Madichvu); lsvCTPT.Items.Add(listdv.Tendichvu); lsvCTPT.Items[i].SubItems.Add(cttp.Ngay.ToString()); lsvCTPT.Items[i].SubItems.Add(cttp.Soluong.ToString()); int sl = cttp.Soluong; decimal gia = listdv.Gia; decimal tien = sl * gia; t += tien; lsvCTPT.Items[i].SubItems.Add(tien.ToString("0,0")); } } } txtTongTien.Text = t.ToString("0,0"); }