Example #1
0
 public ActionResult listphieuthu(int id)
 {
     if (Request.IsAjaxRequest())
     {
         var model = PhieuThuService.GetAll(id);
         return(PartialView(model));
     }
     return(View());
 }
Example #2
0
 public ActionResult CreatePhieuthu(phieuthu pt)
 {
     if (Request.IsAjaxRequest())
     {
         var rq = PhieuThuService.insert(pt);
         return(Json(rq, JsonRequestBehavior.AllowGet));
     }
     return(View());
 }
Example #3
0
        private void updatePhieuThu()
        {
            DateTime        ngay            = this.dateNgay.DateTime;
            long            soTien          = (long)this.txtSoTien.Value;
            string          maPhieu         = this.txtMaPhieu.Text;
            string          ghiChu          = this.txtGhiChu.Text;
            int?            hocSinhId       = (int?)this.cmbHocSinh.EditValue;
            int?            phanLoaiThuId   = (int?)this.cmbPhanLoaiThu.EditValue;
            PhieuThuService phieuThuService = new PhieuThuService();

            phieuThuService.UpdatePhieuThu(this.PhieuThuRow, ngay, soTien, maPhieu, ghiChu, hocSinhId, phanLoaiThuId);
        }
Example #4
0
        private void luuPhieuThu()
        {
            if (this.IsEditing)
            {
                this.updatePhieuThu();
            }
            else
            {
                this.insertPhieuThu();
            }

            if (this.GridView != null)
            {
                HocSinhTableAdapter hocSinhTableAdapter   = (HocSinhTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterHocSinh);
                BindingSource       phieuThuBindingSource = this.GridView.GridControl.DataSource as BindingSource;
                PhieuThuService     phieuThuService       = new PhieuThuService();
                phieuThuBindingSource.DataSource = phieuThuService.LoadPhieuThu(hocSinhTableAdapter.GetData());
            }
        }
Example #5
0
        private void btnXemBaoCao_Click(object sender, EventArgs e)
        {
            if (this.dateTuNgay.DateTime == null || this.dateDenNgay.DateTime == null)
            {
                MessageBox.Show("Xin vui lòng chọn ngày", "Chọn ngày", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            List <int> phanLoaiThuIds = new List <int>();

            int[] selectedThuRowHandlers = this.gvThu.GetSelectedRows();

            if (ArrayUtil.IsEmpty(selectedThuRowHandlers))
            {
                MessageBox.Show("Xin vui lòng chọn Phân loại thu", "Chọn Phân loại thu", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            foreach (int rowHandler in selectedThuRowHandlers)
            {
                int phanLoaiThuId = (int)this.gvThu.GetRowCellValue(rowHandler, "PhanLoaiThuId");
                phanLoaiThuIds.Add(phanLoaiThuId);
            }

            List <int> phanLoaiChiIds = new List <int>();

            int[] selectedRowHandlers = this.gvMain.GetSelectedRows();

            if (ArrayUtil.IsEmpty(selectedRowHandlers))
            {
                MessageBox.Show("Xin vui lòng chọn Mã loại chi", "Chọn Mã loại chi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (chkTon.Checked && StringUtil.IsEmpty(txtTon.Text))
            {
                MessageBox.Show("Xin vui lòng nhập số tiền tồn tháng trước", "Nhập số tiền tồn tháng trước", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            foreach (int rowHandler in selectedRowHandlers)
            {
                int phanLoaiChiId = (int)this.gvMain.GetRowCellValue(rowHandler, "PhanLoaiChiId");
                phanLoaiChiIds.Add(phanLoaiChiId);
            }

            DateTime fromDate = DateTimeUtil.StartOfDate(this.dateTuNgay.DateTime);
            DateTime toDate   = DateTimeUtil.EndOfDate(this.dateDenNgay.DateTime);

            UnknownColumnViewTableAdapter unknownColumnViewTableAdapter = (UnknownColumnViewTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterUnknownColumnView);
            RptTinhHinhThuChi             rpt = new RptTinhHinhThuChi();

            rpt.TuNgay.Value  = fromDate;
            rpt.DenNgay.Value = toDate;
            rpt.TongThu.Value = unknownColumnViewTableAdapter.GetSumSoTienThuByDateRange(fromDate, toDate, StringUtil.JoinWithCommas(phanLoaiThuIds));
            rpt.TongChi.Value = unknownColumnViewTableAdapter.GetSumSoTienChiByDateRange(fromDate, toDate, StringUtil.JoinWithCommas(phanLoaiChiIds));

            rpt.Ton.Value       = findSoTienTonDauKy(toDate);
            rpt.ChenhLech.Value = (decimal)rpt.Ton.Value + (decimal)rpt.TongThu.Value - (decimal)rpt.TongChi.Value;

            PhieuThuService phieuThuService = new PhieuThuService();

            rpt.thuDataSource.DataSource = phieuThuService.LoadPhieuThuByDateRangeWithGroupPhanLoaiThu(fromDate, toDate, phanLoaiThuIds);

            PhieuChiService phieuChiService = new PhieuChiService();

            rpt.chiDataSource.DataSource = phieuChiService.LoadPhieuChiByDateRangeWithGroupPhanLoaiChi(fromDate, toDate, phanLoaiChiIds);

            FormMainFacade.ShowReport(rpt);
        }
Example #6
0
        private void loadPhieuThu()
        {
            PhieuThuService phieuThuService = new PhieuThuService();

            this.phieuThuRowBindingSource.DataSource = phieuThuService.LoadPhieuThu(this._hocSinhTable);
        }