Ejemplo n.º 1
0
        void Create_Fee()
        {
            try
            {
                if (txtFee.Text == "")
                {
                    NoteBox.Show("Bạn chưa nhập phí môi giới", "", NoteBoxLevel.Error);
                    return;
                }

                c_lst_Fee = new List <Fees_Revenue_Info>();
                Fees_Revenue_Info _Fees_Revenue_Info = new Fees_Revenue_Info();

                _Fees_Revenue_Info.Number_Payment    = 1;
                _Fees_Revenue_Info.Object_Type       = (decimal)Enum_Contract_Type.Renter;
                _Fees_Revenue_Info.Fee_Expected      = Convert.ToDecimal(txtFee.Text);
                _Fees_Revenue_Info.Fee               = 0;
                _Fees_Revenue_Info.Debit_Amount      = _Fees_Revenue_Info.Fee_Expected;
                _Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpFromDate.Text);
                _Fees_Revenue_Info.Is_Extend         = 0;
                _Fees_Revenue_Info.Pay_Status        = (decimal)Enum_Fee_Status.No_Pay;
                c_lst_Fee.Add(_Fees_Revenue_Info);

                dgrFee.ItemsSource = c_lst_Fee;
                dgrFee.Items.Refresh();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 2
0
 public bool Fees_Revenue_Update(Fees_Revenue_Info Fees_Revenue_Info)
 {
     try
     {
         return(CommonData.c_serviceWCF.Fees_Revenue_Update(Fees_Revenue_Info.Fee_Id, Fees_Revenue_Info.Pay_Date, Fees_Revenue_Info.Fee,
                                                            Fees_Revenue_Info.Pay_Status, Fees_Revenue_Info.Debit_Amount));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool Fees_Revenue_Insert(Fees_Revenue_Info p_Fees_Revenue_Info)
 {
     try
     {
         return(CommonData.c_serviceWCF.Fees_Revenue_Insert(p_Fees_Revenue_Info.Contract_Id, p_Fees_Revenue_Info.Object_Id, p_Fees_Revenue_Info.Object_Type,
                                                            p_Fees_Revenue_Info.Currency, p_Fees_Revenue_Info.Number_Payment, p_Fees_Revenue_Info.Pay_Date_Expected, p_Fees_Revenue_Info.Pay_Date,
                                                            p_Fees_Revenue_Info.Fee_Expected, p_Fees_Revenue_Info.Fee, p_Fees_Revenue_Info.Pay_Status,
                                                            p_Fees_Revenue_Info.Date_Of_Bill, p_Fees_Revenue_Info.Debit_Amount, p_Fees_Revenue_Info.Is_Extend, p_Fees_Revenue_Info.Fee_Vnd));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(false);
     }
 }
Ejemplo n.º 4
0
        bool Check_validate_Fee()
        {
            try
            {
                if (c_lst_Fee.Count == 0)
                {
                    NoteBox.Show("Không có thông tin thanh toán phí gia hạn", "", NoteBoxLevel.Error);
                    tabFee.Focus();
                    UpdateLayout();
                    txtFeeOnePay.Focus();
                    return(false);
                }

                if (c_ok == false)
                {
                    NoteBox.Show("Số tiền 1 lần thanh toán không đúng định dạng", "", NoteBoxLevel.Error);
                    tabFee.Focus();
                    UpdateLayout();
                    return(false);
                }

                for (int i = 0; i < c_lst_Fee.Count; i++)
                {
                    Fees_Revenue_Info item = c_lst_Fee[i];

                    string _tem = item.Fee_Expected.ToString().Replace(",", "").Trim();
                    if (CheckGiaDuong(_tem) == false)
                    {
                        tabFee.Focus();
                        UpdateLayout();
                        DataGridHelper.NVSFocus(dgrFee, i, 2);
                        return(false);
                    }
                }


                return(true);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(false);
            }
        }
Ejemplo n.º 5
0
        void Export_Payment()
        {
            try
            {
                c_row_select = dgrContract.SelectedIndex;
                Contract_Info _Contract_Info = (Contract_Info)dgrContract.SelectedItem;

                if (_Contract_Info == null)
                {
                    return;
                }

                List <Fees_Revenue_Info> _lst = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(_Contract_Info.Contract_Id);
                Fees_Revenue_Info        _Fees_Revenue_Info = new Fees_Revenue_Info();

                bool _is_not_pay = false;

                // kiểm tra xem đã thanh toán hết chưa
                foreach (Fees_Revenue_Info item in _lst)
                {
                    if (item.Pay_Status == (decimal)Enum_Fee_Status.No_Pay)
                    {
                        _is_not_pay        = true;
                        _Fees_Revenue_Info = item;
                        break;
                    }
                }

                if (_is_not_pay == false)
                {
                    NoteBox.Show("Đã thanh toán hết, không thể yêu cầu thanh toán", "", NoteBoxLevel.Error);
                    return;
                }

                Estate_Object_Info _Estate_Object_Info = _Estate_Object_Controller.Estate_Object_GetById(_Contract_Info.Estate_Id, (decimal)Enum_Contract_Type.Renter);
                Customer_Info      _Customer_Info      = _Customer_Controller.Customer_GetById(_Contract_Info.Object_Id);

                CommonFunction.Export_payment(_Contract_Info, _Customer_Info, _Estate_Object_Info, _Fees_Revenue_Info);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 6
0
        void LoadData()
        {
            try
            {
                c_lst_Fee_All = _Fees_Revenue_Controller.Fees_Revenue_GetByContract(c_Contract_Info.Contract_Id);


                foreach (Fees_Revenue_Info item in c_lst_Fee_All)
                {
                    if (item.Pay_Status == (decimal)Enum_Fee_Status.Payed)
                    {
                        c_lst_Fee_Pay.Add(item);
                    }
                }

                c_index = 0;
                foreach (Fees_Revenue_Info item in c_lst_Fee_All)
                {
                    if (item.Pay_Status != (decimal)Enum_Fee_Status.Payed)
                    {
                        c_Fees_MustPay = item;
                        break;
                    }
                    c_index++;
                }

                txtFeeExpected.Text       = c_Fees_MustPay.Fee_Expected.ToString();
                txtPay_Date_Expected.Text = c_Fees_MustPay.Pay_Date_Expected.ToString("dd/MM/yyyy");

                dpPay_Date.Text = Common.ConvertData.ConvertDate2String(DateTime.Now);

                dgrFee.ItemsSource = c_lst_Fee_Pay;
                txtFeePay.Focus();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 7
0
        void Accept()
        {
            try
            {
                if (txtFeePay.Text == "")
                {
                    NoteBox.Show("Số tiền thanh toán không được để trống");
                    txtFeePay.Focus();
                    return;
                }

                if (dpPay_Date.Text == "")
                {
                    NoteBox.Show("Ngày thanh toán không được để trống", "", NoteBoxLevel.Error);
                    dpPay_Date.Focus();
                    return;
                }
                if (CheckValidate.CheckValidDate(dpPay_Date.Text) == false)
                {
                    NoteBox.Show("Ngày thanh toán không đúng định dạng", "", NoteBoxLevel.Error);
                    dpPay_Date.Focus();
                    return;
                }

                Fees_Revenue_Info _Fees_Revenue_Info = new Fees_Revenue_Info();
                _Fees_Revenue_Info.Fee_Id       = c_Fees_MustPay.Fee_Id;
                _Fees_Revenue_Info.Pay_Date     = Common.ConvertData.ConvertString2Date(dpPay_Date.Text);
                _Fees_Revenue_Info.Fee          = Convert.ToDecimal(txtFeePay.Text);
                _Fees_Revenue_Info.Debit_Amount = c_Fees_MustPay.Fee_Expected - _Fees_Revenue_Info.Fee;
                _Fees_Revenue_Info.Pay_Status   = (decimal)Enum_Fee_Status.Payed;

                MessageBoxResult result = NoteBox.Show("Bạn có muốn thanh toán phí môi giới cho hợp đồng này hay không?", "Thông báo", NoteBoxLevel.Question);
                if (MessageBoxResult.Yes != result)
                {
                    return;
                }

                if (_Fees_Revenue_Controller.Fees_Revenue_Update(_Fees_Revenue_Info) == false)
                {
                    NoteBox.Show("Lỗi thanh toán", "", NoteBoxLevel.Error);
                    return;
                }

                Contract_Info _Contract_Info = c_Contract_Info;

                if (c_index == c_lst_Fee_All.Count - 1)
                {
                    _Contract_Info.Fee_Status = (decimal)Enum_Fee_Status.Payed;
                }
                else
                {
                    _Contract_Info.Fee_Status = (decimal)Enum_Fee_Status.No_Pay;
                }

                if (_Contract_Controller.Contract_Update(c_Contract_Info.Contract_Id, _Contract_Info) == false)
                {
                    NoteBox.Show("Lỗi cập nhật hợp đồng cho thuê nhà", "", NoteBoxLevel.Error);
                    return;
                }

                NoteBox.Show("Thanh toán phí thành công");
                c_ok = true;
                this.Close();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }
Ejemplo n.º 8
0
        void Create_DataFee_Maturity()
        {
            try
            {
                c_lst_Fee = new List <Fees_Revenue_Info>();

                decimal _fee_one_pay    = 0;
                decimal _term_pay_chose = Convert.ToDecimal(cboTerm.SelectedValue);
                int     _number_pay     = 1;
                int     _number_Ternm   = 1;

                // lấy thời gian thuê nhà theo tháng

                int _month = Call_Month_ByRangeDate(ConvertData.ConvertString2Date(dpFromDate.Text), ConvertData.ConvertString2Date(dpToDate.Text));

                // lấy kỳ hạn thanh toán
                if (_term_pay_chose == (decimal)Enum_Fee_Maturity.One)
                {
                    _number_pay = 1;
                }
                else if (_term_pay_chose == (decimal)Enum_Fee_Maturity.One_Month)
                {
                    _number_pay   = _month / 1;
                    _number_Ternm = 1;
                }
                else if (_term_pay_chose == (decimal)Enum_Fee_Maturity.Three_Month)
                {
                    _number_pay   = _month / 3;
                    _number_Ternm = 3;
                }
                else if (_term_pay_chose == (decimal)Enum_Fee_Maturity.Six_Month)
                {
                    _number_pay   = _month / 6;
                    _number_Ternm = 6;
                }
                else if (_term_pay_chose == (decimal)Enum_Fee_Maturity.One_Year)
                {
                    _number_Ternm = 12;
                    if (_month < 12)
                    {
                        _number_pay = 1;
                    }
                    else
                    {
                        _number_pay = _month / 12;
                    }
                }

                _fee_one_pay = Math.Round(Convert.ToDecimal(txtFee.Text) / _number_pay);
                if (c_is_option_pay == true)
                {
                    if (txtFeeOnePay.Text == "")
                    {
                        NoteBox.Show("Số tiền 1 lần thanh toán không được để trống", "", NoteBoxLevel.Error);
                        return;
                    }

                    if (txtNumberPay.Text == "")
                    {
                        NoteBox.Show("Số lần thanh toán không được để trống", "", NoteBoxLevel.Error);
                        return;
                    }
                    _fee_one_pay = Convert.ToDecimal(txtFeeOnePay.Text);
                    _number_pay  = Convert.ToInt16(txtNumberPay.Text);

                    _number_Ternm = _month / _number_pay;
                }

                txtFeeOnePay.Text = _fee_one_pay.ToString();

                if (_number_pay > 0)
                {
                    for (int i = 0; i < _number_pay; i++)
                    {
                        int _add_month = (i + 1) * _number_Ternm;

                        Fees_Revenue_Info _Fees_Revenue_Info = new Fees_Revenue_Info();
                        _Fees_Revenue_Info.Number_Payment = i + 1;
                        _Fees_Revenue_Info.Object_Type    = (decimal)Enum_Contract_Type.Tenant;
                        _Fees_Revenue_Info.Fee_Expected   = _fee_one_pay;

                        _Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpFromDate.Text).AddMonths(3);

                        // nếu thanh toán 1 lần thì lấy ngày thanh toán  = ngày ký hợp đồng luôn
                        if (_number_pay == 1)
                        {
                            _Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpContractDate.Text);
                        }
                        else
                        {
                            if (i == 0)
                            {
                                _Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpFromDate.Text);
                            }
                            else
                            {
                                Fees_Revenue_Info _Fees_Pre = c_lst_Fee[i - 1];

                                // nếu không thì cứ lấy ngày bắt đầu thuê nhà + thêm kỳ hạn thanh toán
                                //_Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpFromDate.Text).AddMonths(_add_month-1);
                                _Fees_Revenue_Info.Pay_Date_Expected = _Fees_Pre.Pay_Date_Expected.AddMonths(_number_Ternm);


                                if (_Fees_Revenue_Info.Pay_Date_Expected > ConvertData.ConvertString2Date(dpToDate.Text))
                                {
                                    _Fees_Revenue_Info.Pay_Date_Expected = ConvertData.ConvertString2Date(dpToDate.Text);
                                }
                            }
                        }
                        c_lst_Fee.Add(_Fees_Revenue_Info);
                    }
                }

                dgrFee.ItemsSource = c_lst_Fee;
                dgrFee.Items.Refresh();
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
            }
        }