Пример #1
0
 protected void btnChuaThanhToan_Click(object sender, DirectEventArgs e)
 {
     try
     {
         BangTamUngController controller = new BangTamUngController();
         RowSelectionModel    sm         = grpCongNoNhanVien.SelectionModel.Primary as RowSelectionModel;
         foreach (var item in sm.SelectedRows)
         {
             BangTamUngInfo tmp = new BangTamUngInfo
             {
                 ID             = int.Parse(item.RecordID),
                 GhiChu         = txtGhiChuThanhToan.Text,
                 DaThanhToanHet = false,
                 SoTienConLai   = decimal.Parse(nbfSoTienConNo.Text)
             };
             controller.UpdateThanhToanCongNo(tmp);
         }
         RM.RegisterClientScriptBlock("grpCongNoNhanVienStore", "grpCongNoNhanVienStore.reload();Store1.reload();");
         wdCapNhatThanhToanCongNo.Hide();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Thông báo lỗi", ex.Message).Show();
     }
 }
Пример #2
0
 public void UpdateThanhToanCongNo(BangTamUngInfo tmp)
 {
     DAL.BangTamUng existing = GetByPrKey(tmp.ID);
     if (existing != null)
     {
         existing.NgayThanhToan = tmp.NgayThanhToan;
         existing.GhiChu        = tmp.GhiChu;
         existing.TepTinDinhKem = tmp.AttachFile;
         if (tmp.DaThanhToanHet)
         {
             existing.SoTienDaTra = existing.SoTien;
         }
         else
         {
             if (tmp.SoTienConLai != 0)
             {
                 existing.SoTienDaTra = existing.SoTien - tmp.SoTienConLai;
             }
             else
             {
                 existing.SoTienDaTra = existing.SoTienDaTra + tmp.SoTienDaTra;
             }
         }
         Save();
     }
 }
Пример #3
0
    protected void btnDaThanhToan_Click(object sender, DirectEventArgs e)
    {
        try
        {
            // upload file
            string path = string.Empty;
            if (fup_fileAttachment.HasFile)
            {
                string directory = Server.MapPath("");
                path = UploadFile(fup_fileAttachment, "File/AttachFile");
            }
            if (path.Equals("-1"))
            {
                X.Msg.Alert("Thông báo", "Kích thước của tệp tin vượt quá quy định (10MB)").Show();
                return;
            }

            BangTamUngController controller = new BangTamUngController();
            RowSelectionModel    sm         = grpCongNoNhanVien.SelectionModel.Primary as RowSelectionModel;
            foreach (var item in sm.SelectedRows)
            {
                BangTamUngInfo tmp = new BangTamUngInfo
                {
                    ID             = int.Parse(item.RecordID),
                    GhiChu         = txtGhiChuThanhToan.Text,
                    NgayThanhToan  = dfNgayThanhToan.SelectedDate,
                    DaThanhToanHet = chkDaThanhToanDu.Checked,
                    SoTienDaTra    = decimal.Parse(nbfSoTienThanhToan.Text)
                };
                if (path != "")
                {
                    tmp.AttachFile = path;
                }
                else
                {
                    tmp.AttachFile = hdfFileAttachment.Text;
                }

                controller.UpdateThanhToanCongNo(tmp);
            }
            RM.RegisterClientScriptBlock("grpCongNoNhanVienStore", "grpCongNoNhanVienStore.reload();Store1.reload();");
            wdCapNhatThanhToanCongNo.Hide();
        }
        catch (Exception ex)
        {
            X.MessageBox.Alert("Thông báo lỗi", ex.Message).Show();
        }
    }