Ejemplo n.º 1
0
 private void txtDieuKienTimKiem_TextChanged(object sender, EventArgs e)
 {
     if (txtDieuKienTimKiem.Text.Length > 3)
     {
         List <NVGDQUAY_ASYNCCLIENT_DTO> dataReturn = new List <NVGDQUAY_ASYNCCLIENT_DTO>();
         dataReturn = TIMKIEM_GIAODICHQUAY(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
         if (dataReturn.Count > 0)
         {
             dgvDanhSachGiaoDichChiTiet.Rows.Clear();
             dgvDanhSachGiaoDichChiTiet.Refresh();
             foreach (NVGDQUAY_ASYNCCLIENT_DTO dataRow in dataReturn)
             {
                 int             LOAIGIADICH = 0;
                 decimal         TIENKHACHDUA, TIENTRALAI, TTIENCOVAT = 0;
                 int             idx     = dgvDanhSachGiaoDichChiTiet.Rows.Add();
                 DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx];
                 rowData.Cells["MAGIAODICH"].Value = dataRow.MAGIAODICH;
                 int.TryParse(dataRow.LOAIGIAODICH.ToString(), out LOAIGIADICH);
                 rowData.Cells["LOAIGIAODICH"].Value      = LOAIGIADICH == 1 ? "XBLE" : "TRL";
                 rowData.Cells["NGAYPHATSINH"].Value      = dataRow.NGAYPHATSINH.ToString("dd/MM/yyyy");
                 rowData.Cells["MANGUOITAO"].Value        = dataRow.MANGUOITAO;
                 rowData.Cells["NGUOITAO"].Value          = dataRow.NGUOITAO;
                 rowData.Cells["MAQUAYBAN"].Value         = dataRow.MAQUAYBAN;
                 rowData.Cells["HINHTHUCTHANHTOAN"].Value = dataRow.HINHTHUCTHANHTOAN;
                 decimal.TryParse(dataRow.TIENKHACHDUA.ToString(), out TIENKHACHDUA);
                 rowData.Cells["TIENKHACHDUA"].Value = FormatCurrency.FormatMoney(TIENKHACHDUA);
                 decimal.TryParse(dataRow.TIENTRALAI.ToString(), out TIENTRALAI);
                 rowData.Cells["TIENTRALAI"].Value = FormatCurrency.FormatMoney(TIENTRALAI);
                 decimal.TryParse(dataRow.TTIENCOVAT.ToString(), out TTIENCOVAT);
                 rowData.Cells["TTIENCOVAT"].Value = FormatCurrency.FormatMoney(TTIENCOVAT);
                 rowData.Cells["THOIGIAN"].Value   = dataRow.THOIGIAN;
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void BINDING_DATA_TO_GRIDVIEW(List <TIMKIEM_VATTU_DTO> LST_TIMKIEM_VATTU_DTO)
 {
     if (LST_TIMKIEM_VATTU_DTO.Count > 0)
     {
         dgvResultSearch.Rows.Clear();
         dgvResultSearch.DataSource = null;
         dgvResultSearch.Refresh();
         foreach (TIMKIEM_VATTU_DTO TIMKIEM_VATTU_DTO in LST_TIMKIEM_VATTU_DTO)
         {
             int             idx     = dgvResultSearch.Rows.Add();
             DataGridViewRow rowData = dgvResultSearch.Rows[idx];
             rowData.Cells["STT"].Value           = idx + 1;
             rowData.Cells["MAVATTU"].Value       = TIMKIEM_VATTU_DTO.MAVATTU;
             rowData.Cells["MAKHAC"].Value        = TIMKIEM_VATTU_DTO.MAKHAC;
             rowData.Cells["TENVATTU"].Value      = TIMKIEM_VATTU_DTO.TENVATTU;
             rowData.Cells["MALOAIVATTU"].Value   = TIMKIEM_VATTU_DTO.MALOAIVATTU;
             rowData.Cells["MANHOMVATTU"].Value   = TIMKIEM_VATTU_DTO.MANHOMVATTU;
             rowData.Cells["DONVITINH"].Value     = TIMKIEM_VATTU_DTO.DONVITINH;
             rowData.Cells["MANHACUNGCAP"].Value  = TIMKIEM_VATTU_DTO.MANHACUNGCAP;
             rowData.Cells["TENNHACUNGCAP"].Value = TIMKIEM_VATTU_DTO.TENNHACUNGCAP;
             rowData.Cells["MAKEHANG"].Value      = TIMKIEM_VATTU_DTO.MAKEHANG;
             rowData.Cells["GIABANLECOVAT"].Value = FormatCurrency.FormatMoney(TIMKIEM_VATTU_DTO.GIABANLECOVAT);
             rowData.Cells["ITEMCODE"].Value      = TIMKIEM_VATTU_DTO.ITEMCODE;
             rowData.Cells["BARCODE"].Value       = TIMKIEM_VATTU_DTO.BARCODE;
         }
     }
 }
        private void LoadPage()
        {
            double reportRevenue = 0;
            int    reportRoom    = 0;
            double reportTime    = 0;

            bills = new BindingList <Bill>(billViewModel.FindAll());
            foreach (var bill in bills)
            {
                bill.CardBookRoom          = cardBookRoomViewModel.FindById(bill.IdCardBookRoom);
                bill.Employee              = employeeViewModel.FindById(bill.IdEmployee);
                bill.CardBookRoom.Room     = roomViewModel.FindById(bill.CardBookRoom.RoomId);
                bill.CardBookRoom.Customer = customerViewModel.FindById(bill.CardBookRoom.CustomerId);
                bill.TotalPrice            = bill.GetTotalPrice();
                reportRevenue             += bill.TotalPrice;
                reportRoom += 1;
                //var timeSpan = bill.CardBookRoom.GetTimeSpan();
                var timeSpan = bill.CardBookRoom.DateReturnRoom - bill.CardBookRoom.DateBookRoom;
                reportTime += timeSpan.TotalHours;
            }

            string money = reportRevenue.ToString();

            /*string.Format("{0:#.00}", Convert.ToDecimal(money) / 100);*/

            /*CultureInfo cul = CultureInfo.GetCultureInfo("vi-VN");   // try with "en-US"
             * string moneyFormatVN= double.Parse(money).ToString("#,###", cul.NumberFormat);*/

            RevenueLabel.Content       = FormatCurrency.FormatCurrencyVN(money) + " đ";
            RoomRentLabel.Content      = reportRoom.ToString();
            TimeRentLabel.Content      = reportTime.ToString();
            ReportListview.ItemsSource = bills;
        }
Ejemplo n.º 4
0
 private void txtDieuKienTimKiem_TextChanged(object sender, EventArgs e)
 {
     if (txtDieuKienTimKiem.Text.Length > 3)
     {
         List <GIAODICH_DTO> dataReturn = new List <GIAODICH_DTO>();
         dataReturn = TIMKIEM_GIAODICHQUAY(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
         if (dataReturn.Count > 0)
         {
             dgvDanhSachGiaoDichChiTiet.Rows.Clear();
             dgvDanhSachGiaoDichChiTiet.Refresh();
             foreach (GIAODICH_DTO dataRow in dataReturn)
             {
                 decimal         TIENKHACH_TRA, TIEN_TRALAI_KHACH, THANHTIEN = 0;
                 int             idx     = dgvDanhSachGiaoDichChiTiet.Rows.Add();
                 DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx];
                 rowData.Cells["MA_GIAODICH"].Value   = dataRow.MA_GIAODICH;
                 rowData.Cells["LOAI_GIAODICH"].Value = dataRow.LOAI_GIAODICH.ToString();
                 rowData.Cells["NGAY_GIAODICH"].Value = dataRow.NGAY_GIAODICH.ToString("dd/MM/yyyy");
                 rowData.Cells["I_CREATE_BY"].Value   = dataRow.I_CREATE_BY;
                 decimal.TryParse(dataRow.TIENKHACH_TRA.ToString(), out TIENKHACH_TRA);
                 rowData.Cells["TIENKHACH_TRA"].Value = FormatCurrency.FormatMoney(TIENKHACH_TRA);
                 decimal.TryParse(dataRow.TIEN_TRALAI_KHACH.ToString(), out TIEN_TRALAI_KHACH);
                 rowData.Cells["TIEN_TRALAI_KHACH"].Value = FormatCurrency.FormatMoney(TIEN_TRALAI_KHACH);
                 decimal.TryParse(dataRow.THANHTIEN.ToString(), out THANHTIEN);
                 rowData.Cells["THANHTIEN"].Value    = FormatCurrency.FormatMoney(THANHTIEN);
                 rowData.Cells["THOIGIAN_TAO"].Value = dataRow.THOIGIAN_TAO;
             }
         }
     }
 }
Ejemplo n.º 5
0
 private void txtThanhToan_TienMat_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.Enter)
     {
         if (!txtThanhToan_TienMat.Text.Equals(txtThanhToan_TienThanhToan.Text))
         {
             decimal THANHTOAN_TIENTHE        = 0;
             string  THANHTOAN_TIENMAT_STRING = txtThanhToan_TienMat.Text;
             int     start = txtThanhToan_TienMat.Text.Length - txtThanhToan_TienMat.SelectionStart;
             THANHTOAN_TIENMAT_STRING = THANHTOAN_TIENMAT_STRING.Replace(",", "");
             decimal THANHTOAN_TIENMAT = 0;
             decimal.TryParse(THANHTOAN_TIENMAT_STRING, out THANHTOAN_TIENMAT);
             TONGTIEN_KHACHTRA = THANHTOAN_TIENMAT;
             decimal THANHTOAN_TONGTIEN = 0;
             decimal.TryParse(txtThanhToan_TienThanhToan.Text.Trim().Replace(",", ""), out THANHTOAN_TONGTIEN);
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENMAT      = THANHTOAN_TIENMAT;
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENKHACHDUA = THANHTOAN_TIENMAT;
             decimal THANHTOAN_TIENTRALAI = THANHTOAN_TIENTHE + THANHTOAN_TIENMAT - THANHTOAN_TONGTIEN;
             txtThanhToan_TienMat.Text           = FormatCurrency.FormatMoney(THANHTOAN_TIENMAT_STRING);
             txtThanhToan_TienMat.SelectionStart = -start + txtThanhToan_TienMat.Text.Length;
             if (THANHTOAN_TIENTRALAI > 0)
             {
                 txtThanhToan_TienTraLai.Text     = FormatCurrency.FormatMoney(THANHTOAN_TIENTRALAI);
                 txtThanhToan_TraLai_BangChu.Text = ConvertSoThanhChu.ChuyenDoiSoThanhChu(THANHTOAN_TIENTRALAI);
             }
             else
             {
                 txtThanhToan_TienTraLai.Text = "-" + FormatCurrency.FormatMoney(THANHTOAN_TIENTRALAI);
             }
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENTRALAI = THANHTOAN_TIENTRALAI;
         }
         else
         {
             return;
         }
     }
     else
     {
         decimal tienThanhToan = 0;
         decimal.TryParse(txtThanhToan_TienTraLai.Text, out tienThanhToan);
         if (tienThanhToan >= 0)
         {
             THANHTOAN_HOADON_BANLE_TRALAI();
         }
         else
         {
             NotificationLauncher.ShowNotificationError("THÔNG BÁO", "SỐ TIỀN SAI !", 1, "0x1", "0x8", "normal");
         }
     }
 }
Ejemplo n.º 6
0
        private void btnTimKiemGiaoDich_Click(object sender, EventArgs e)
        {
            if (txtDieuKienTimKiem.Text.Length > 3)
            {
                List <NVGDQUAY_ASYNCCLIENT_DTO> dataReturn = new List <NVGDQUAY_ASYNCCLIENT_DTO>();
                string msg = Config.CheckConnectToServer(out bool result);
                if (msg.Length > 0)
                {
                    MessageBox.Show(msg); return;
                }

                if (result)
                {
                    dataReturn = TIMKIEM_GIAODICHQUAY(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
                }
                else
                {
                    dataReturn = UC_Frame_TraLai.TIMKIEM_GIAODICHQUAY_FROM_SQL(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
                }

                if (dataReturn.Count > 0)
                {
                    dgvDanhSachGiaoDichChiTiet.Rows.Clear();
                    dgvDanhSachGiaoDichChiTiet.Refresh();
                    foreach (NVGDQUAY_ASYNCCLIENT_DTO dataRow in dataReturn)
                    {
                        int             LOAIGIADICH = 0;
                        decimal         TIENKHACHDUA, TIENTRALAI, TTIENCOVAT = 0;
                        int             idx     = dgvDanhSachGiaoDichChiTiet.Rows.Add();
                        DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx];
                        rowData.Cells["MAGIAODICH"].Value = dataRow.MAGIAODICH;
                        int.TryParse(dataRow.LOAIGIAODICH.ToString(), out LOAIGIADICH);
                        rowData.Cells["LOAIGIAODICH"].Value      = LOAIGIADICH == 1 ? "XBLE" : "TRL";
                        rowData.Cells["NGAYPHATSINH"].Value      = dataRow.NGAYPHATSINH.ToString("dd/MM/yyyy");
                        rowData.Cells["MANGUOITAO"].Value        = dataRow.MANGUOITAO;
                        rowData.Cells["NGUOITAO"].Value          = dataRow.NGUOITAO;
                        rowData.Cells["MAQUAYBAN"].Value         = dataRow.MAQUAYBAN;
                        rowData.Cells["HINHTHUCTHANHTOAN"].Value = dataRow.HINHTHUCTHANHTOAN;
                        decimal.TryParse(dataRow.TIENKHACHDUA.ToString(), out TIENKHACHDUA);
                        rowData.Cells["TIENKHACHDUA"].Value = FormatCurrency.FormatMoney(TIENKHACHDUA);
                        decimal.TryParse(dataRow.TIENTRALAI.ToString(), out TIENTRALAI);
                        rowData.Cells["TIENTRALAI"].Value = FormatCurrency.FormatMoney(TIENTRALAI);
                        decimal.TryParse(dataRow.TTIENCOVAT.ToString(), out TTIENCOVAT);
                        rowData.Cells["TTIENCOVAT"].Value = FormatCurrency.FormatMoney(TTIENCOVAT);
                        rowData.Cells["THOIGIAN"].Value   = dataRow.THOIGIAN;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public FrmThanhToanTraLai(NVGDQUAY_ASYNCCLIENT_DTO NVGDQUAY_ASYNCCLIENT_DTO, NVGDQUAY_ASYNCCLIENT_DTO _NVGDQUAY_ASYNCCLIENT_BILL)
        {
            _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL  = NVGDQUAY_ASYNCCLIENT_DTO;
            _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL = _NVGDQUAY_ASYNCCLIENT_BILL;
            InitializeComponent();
            int _currentUcFrame = FrmMain._currentUcFrame;

            this.Text = "THANH TOÁN HÓA ĐƠN TRẢ LẠI " + (_currentUcFrame + 1);
            txtThanhToan_MaGiaoDich.Text    = _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.MAGIAODICH;
            txtThanhToan_TienThanhToan.Text = FormatCurrency.FormatMoney(_NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TTIENCOVAT);
            txtThanhToan_TienMat.Text       = FormatCurrency.FormatMoney(_NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TTIENCOVAT);
            txtThanhToan_TienMat.Focus();
            this.ActiveControl = txtThanhToan_TienMat;
            txtThanhToan_TienMat.SelectAll();
            decimal.TryParse(txtThanhToan_TienMat.Text.Trim(), out TONGTIEN_KHACHTRA);
        }
Ejemplo n.º 8
0
        private void StartForm()
        {
            List <GIAODICH_DTO> dataReturn = new List <GIAODICH_DTO>();

            if (Config.CheckConnectToServer())
            {
                dataReturn = TIMKIEM_GIAODICHQUAY("", dateTimeTuNgay.Value,
                                                  dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
            }
            else
            {
                dataReturn = UC_Frame_TraLai.TIMKIEM_GIAODICHQUAY_FROM_SQL("", dateTimeTuNgay.Value,
                                                                           dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE);
            }
            if (dataReturn.Count > 0)
            {
                dgvDanhSachGiaoDichChiTiet.Rows.Clear();
                dgvDanhSachGiaoDichChiTiet.Refresh();
                foreach (GIAODICH_DTO dataRow in dataReturn)
                {
                    decimal         TIENKHACH_TRA, TIEN_TRALAI_KHACH, THANHTIEN = 0;
                    int             idx     = dgvDanhSachGiaoDichChiTiet.Rows.Add();
                    DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx];
                    rowData.Cells["MA_GIAODICH"].Value   = dataRow.MA_GIAODICH;
                    rowData.Cells["LOAI_GIAODICH"].Value = dataRow.LOAI_GIAODICH.ToString();
                    rowData.Cells["NGAY_GIAODICH"].Value = dataRow.NGAY_GIAODICH.ToString("dd/MM/yyyy");
                    rowData.Cells["I_CREATE_BY"].Value   = dataRow.I_CREATE_BY;
                    decimal.TryParse(dataRow.TIENKHACH_TRA.ToString(), out TIENKHACH_TRA);
                    rowData.Cells["TIENKHACH_TRA"].Value = FormatCurrency.FormatMoney(TIENKHACH_TRA);
                    decimal.TryParse(dataRow.TIEN_TRALAI_KHACH.ToString(), out TIEN_TRALAI_KHACH);
                    rowData.Cells["TIEN_TRALAI_KHACH"].Value = FormatCurrency.FormatMoney(TIEN_TRALAI_KHACH);
                    decimal.TryParse(dataRow.THANHTIEN.ToString(), out THANHTIEN);
                    rowData.Cells["THANHTIEN"].Value    = FormatCurrency.FormatMoney(THANHTIEN);
                    rowData.Cells["THOIGIAN_TAO"].Value = dataRow.THOIGIAN_TAO;
                }
            }
        }
Ejemplo n.º 9
0
 private void txtThanhToan_TienMat_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (txtThanhToan_TienMat.Text.Trim().Length > 0)
     {
         decimal TIENMAT_KHACHTRA, TONGTIEN_HOADON, TIEN_TRALAI = 0;
         decimal.TryParse(txtThanhToan_TienMat.Text.Trim(), out TIENMAT_KHACHTRA);
         decimal.TryParse(txtThanhToan_TienThanhToan.Text.Trim(), out TONGTIEN_HOADON);
         TIEN_TRALAI = TIENMAT_KHACHTRA - TONGTIEN_HOADON;
         if (TIEN_TRALAI >= 0 && TIEN_TRALAI < 1000000)
         {
             txtThanhToan_TienTraLai.Text     = FormatCurrency.FormatMoney(TIEN_TRALAI);
             txtThanhToan_TraLai_BangChu.Text = ConvertSoThanhChu.ChuyenDoiSoThanhChu(TIEN_TRALAI);
             btnThanhToan_Save.Focus();
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENMAT      = TIENMAT_KHACHTRA;
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENTRALAI   = TIEN_TRALAI;
             _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENKHACHDUA = TIENMAT_KHACHTRA;
         }
         else if (TIEN_TRALAI < 0)
         {
             txtThanhToan_TienMat.SelectAll();
         }
         else
         {
             DialogResult result = MessageBox.Show("SỐ TIỀN TRẢ LẠI QUÁ LỚN ?", "THAO TÁC SAI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             if (result == DialogResult.OK)
             {
                 TIEN_TRALAI = TIEN_TRALAI / 10;
                 txtThanhToan_TienTraLai.Text                  = FormatCurrency.FormatMoney(TIEN_TRALAI);
                 txtThanhToan_TraLai_BangChu.Text              = ConvertSoThanhChu.ChuyenDoiSoThanhChu(TIEN_TRALAI);
                 _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENMAT      = TIENMAT_KHACHTRA;
                 _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENTRALAI   = TIEN_TRALAI;
                 _NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TIENKHACHDUA = TIENMAT_KHACHTRA;
             }
         }
     }
 }
Ejemplo n.º 10
0
 // GIAO DỊCH BÁN LẺ
 public void InitDataBillBanLeTraLai(GIAODICH_DTO _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL, BILL_DTO objecBillDto)
 {
     p_Phone.Value        = objecBillDto.PHONE;
     p_Address.Value      = objecBillDto.ADDRESS;
     p_MaGiaoDich.Value   = objecBillDto.MA_GIAODICH;
     p_InfoThuNgan.Value  = objecBillDto.INFOTHUNGAN;
     p_MaKH.Value         = objecBillDto.MAKH;
     p_Diem.Value         = objecBillDto.DIEM;
     p_ThanhTienChu.Value = objecBillDto.THANHTIENCHU;
     p_ConLai.Value       = objecBillDto.CONLAI;
     p_TienKhachTra.Value = objecBillDto.TIENKHACHTRA;
     p_TenCuaHang.Value   = objecBillDto.TENCUAHANG;
     if (_NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS.Count > 0)
     {
         List <VATTU_DTO.OBJ_VAT> obj_Vat = new List <VATTU_DTO.OBJ_VAT>();
         foreach (var rowData in _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS)
         {
             var existVat = obj_Vat.FirstOrDefault(x => x.MATHUE_RA == rowData.MATHUE_RA);
             if (existVat != null)
             {
                 existVat.CHUACO_GTGT += rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100));
                 existVat.CO_GTGT     += (rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100))) * (rowData.GIATRI_THUE_RA / 100);
             }
             else
             {
                 VATTU_DTO.OBJ_VAT vat = new VATTU_DTO.OBJ_VAT();
                 vat.MATHUE_RA      = rowData.MATHUE_RA;
                 vat.GIATRI_THUE_RA = rowData.GIATRI_THUE_RA;
                 vat.CHUACO_GTGT    = rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100));
                 vat.CO_GTGT        = vat.CHUACO_GTGT * (vat.GIATRI_THUE_RA / 100);
                 obj_Vat.Add(vat);
             }
             decimal tempKM = 0;
             try
             {
                 tempKM = rowData.TIEN_KHUYENMAI + rowData.TIEN_CHIETKHAU;
             }
             catch (Exception) { }
             if (tempKM != 0)
             {
                 rowData.THANHTIENFULL = string.Format(@"KM " + FormatCurrency.FormatMoney(tempKM) + " " + FormatCurrency.FormatMoney(rowData.THANHTIEN));
             }
             else
             {
                 rowData.THANHTIENFULL = FormatCurrency.FormatMoney(rowData.THANHTIEN);
             }
             int vattat = 0;
             int.TryParse(rowData.MATHUE_RA, out vattat);
             rowData.MAVATTAT = vattat.ToString();
         }
         if (obj_Vat.Count > 0)
         {
             decimal TONGCHUAVAT = 0, TONGCOVAT = 0;
             foreach (VATTU_DTO.OBJ_VAT item in obj_Vat)
             {
                 int vattat = 0;
                 int.TryParse(item.MATHUE_RA, out vattat);
                 XRTableRow row = new XRTableRow();
                 row.Cells.Add(new XRTableCell()
                 {
                     Text          = vattat.ToString() + " > " + item.GIATRI_THUE_RA.ToString("#0'%'"),
                     TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                     Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
                 });
                 row.Cells.Add(new XRTableCell()
                 {
                     Text          = item.CHUACO_GTGT.ToString("##,###"),
                     TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                     Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
                 });
                 row.Cells.Add(new XRTableCell()
                 {
                     Text          = item.CO_GTGT.ToString("##,###"),
                     TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                     Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
                 });
                 xtVAT.Rows.Add(row);
                 TONGCHUAVAT += item.CHUACO_GTGT;
                 TONGCOVAT   += item.CO_GTGT;
             }
             XRTableRow rowData = new XRTableRow();
             rowData.Cells.Add(new XRTableCell()
             {
                 Text          = "Tổng : ",
                 TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                 Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
             });
             rowData.Cells.Add(new XRTableCell()
             {
                 Text          = TONGCHUAVAT.ToString("##,###"),
                 TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                 Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
             });
             rowData.Cells.Add(new XRTableCell()
             {
                 Text          = TONGCOVAT.ToString("##,###"),
                 TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
                 Font          = new Font(Font.FontFamily, 6, FontStyle.Regular)
             });
             xtTong.Rows.Add(rowData);
         }
     }
     objectDataSource1.DataSource = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS;
 }
Ejemplo n.º 11
0
        public FrmTimKiemGiaoDich(string KeySearch, DateTime TuNgay, DateTime DenNgay, int DieuKienLoc)
        {
            InitializeComponent();
            //khởi tạo giá trị chọn lựa điều kiện tìm kiếm
            BindingList <TIMKIEM_DTO> _comboItems = new BindingList <TIMKIEM_DTO>();

            _comboItems.Add(new TIMKIEM_DTO {
                VALUE = 0, TEXT = "Mã giao dịch"
            });
            _comboItems.Add(new TIMKIEM_DTO {
                VALUE = 1, TEXT = "Số tiền"
            });
            _comboItems.Add(new TIMKIEM_DTO {
                VALUE = 2, TEXT = "Thu ngân tạo"
            });
            cboDieuKienTimKiem.DataSource    = _comboItems;
            cboDieuKienTimKiem.DisplayMember = "TEXT";
            cboDieuKienTimKiem.ValueMember   = "VALUE";
            //default combobox
            cboDieuKienTimKiem.SelectedIndex = DieuKienLoc;

            dateTimeDenNgay.Format       = DateTimePickerFormat.Custom;
            dateTimeDenNgay.CustomFormat = "dd/MM/yyyy";
            this.dateTimeDenNgay.Value   = DenNgay;
            dateTimeTuNgay.Format        = DateTimePickerFormat.Custom;
            dateTimeTuNgay.CustomFormat  = "dd/MM/yyyy";
            this.dateTimeTuNgay.Value    = TuNgay;

            txtDieuKienTimKiem.Text = KeySearch.Trim();
            try
            {
                using (
                    var connection =
                        new OracleConnection(ConfigurationManager.ConnectionStrings["TBNETERP_SERVER"].ConnectionString))
                {
                    connection.OpenAsync();
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection           = connection;
                    cmd.InitialLONGFetchSize = 1000;
                    cmd.CommandText          = "TIMKIEM_GIAODICHQUAY";
                    cmd.CommandType          = CommandType.StoredProcedure;
                    cmd.Parameters.Add("P_KEYSEARCH", OracleDbType.Varchar2).Value        = KeySearch;
                    cmd.Parameters.Add("P_TUNGAY", OracleDbType.Date).Value               = TuNgay;
                    cmd.Parameters.Add("P_DENNGAY", OracleDbType.Date).Value              = DenNgay;
                    cmd.Parameters.Add("P_DIEUKIENLOC", OracleDbType.Int32).Value         = DieuKienLoc;
                    cmd.Parameters.Add("P_UNITCODE", OracleDbType.Varchar2).Value         = Session.Session.CurrentUnitCode;
                    cmd.Parameters.Add("CURSOR_RESULT", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
                    OracleDataReader dataReader = null;
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.HasRows)
                    {
                        dgvDanhSachGiaoDichChiTiet.Rows.Clear();
                        dgvDanhSachGiaoDichChiTiet.DataSource = null;
                        dgvDanhSachGiaoDichChiTiet.Refresh();
                        while (dataReader.Read())
                        {
                            int             LOAIGIAODICH = 0;
                            int             idx          = dgvDanhSachGiaoDichChiTiet.Rows.Add();
                            DataGridViewRow rowData      = dgvDanhSachGiaoDichChiTiet.Rows[idx];
                            rowData.Cells["MAGIAODICH"].Value = dataReader["MAGIAODICH"];
                            int.TryParse(dataReader["LOAIGIAODICH"].ToString(), out LOAIGIAODICH);
                            rowData.Cells["LOAIGIAODICH"].Value      = LOAIGIAODICH == 1 ? "XBLE" : "TRL";
                            rowData.Cells["NGAYPHATSINH"].Value      = dataReader["NGAYPHATSINH"];
                            rowData.Cells["MANGUOITAO"].Value        = dataReader["MANGUOITAO"];
                            rowData.Cells["NGUOITAO"].Value          = dataReader["NGUOITAO"];
                            rowData.Cells["MAQUAYBAN"].Value         = dataReader["MAQUAYBAN"];
                            rowData.Cells["HINHTHUCTHANHTOAN"].Value = dataReader["HINHTHUCTHANHTOAN"];
                            rowData.Cells["TIENKHACHDUA"].Value      = FormatCurrency.FormatMoney(dataReader["TIENKHACHDUA"]);
                            rowData.Cells["TIENTRALAI"].Value        = FormatCurrency.FormatMoney(dataReader["TIENTRALAI"]);
                            rowData.Cells["TTIENCOVAT"].Value        = FormatCurrency.FormatMoney(dataReader["TTIENCOVAT"]);
                            rowData.Cells["THOIGIAN"].Value          = FormatCurrency.FormatMoney(dataReader["THOIGIAN"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLogs.LogError(ex);
                NotificationLauncher.ShowNotification("Thông báo", "Không tìm thấy", 1, "0x1", "0x8", "normal");
            }
        }