Beispiel #1
0
        private Tb_Voucher getvoucher()
        {
            Tb_Voucher voucher = new Tb_Voucher();

            if (check_input())
            {
                voucher.Id           = Voucher_ID.Text;
                voucher.Is_Approved  = false;
                voucher.Is_deleted   = false;
                voucher.Is_Receved   = true;
                voucher.Emp_Id       = Emp_No.Text;
                voucher.Requsted_By  = Emp_No.Text;
                voucher.Recived_By   = Emp_No.Text;
                voucher.Payment_Way  = Payment_Way.Text;
                voucher.Requste_Date = Convert.ToDateTime(Request_Date.Text);
                voucher.Recived_Date = Convert.ToDateTime(Recived_Date.Text);
                if (Payment_Way.SelectedItem.ToString() == "Cheque")
                {
                    voucher.Is_Cheque   = true;
                    voucher.Cheque_Date = Convert.ToDateTime(Cheque_dateDateEdit.Text);
                    voucher.Cheque_No   = Cheque_NoTextEdit.Text;
                    voucher.Cheque_Bank = ItemForCheque_Bank.Text;
                }
                voucher.Payment_Way = Payment_Way.Text;
                voucher.Amount      = Convert.ToDecimal(amountTextEdit.Text);
            }
            return(voucher);
        }
Beispiel #2
0
        private Tb_Voucher getvoucher()
        {
            Tb_Voucher voucher = new Tb_Voucher();

            if (check_input())
            {
                voucher.Id           = txt_VoucherId.Text;
                voucher.Is_Approved  = false;
                voucher.Is_deleted   = false;
                voucher.Is_Receved   = true;
                voucher.Type         = Voucher_Type.Text;
                voucher.Emp_Id       = Emp_No.Text;
                voucher.Requsted_By  = Emp_No.Text;
                voucher.Recived_By   = Emp_No.Text;
                voucher.Payment_Way  = Payment_Way.Text;
                voucher.Requste_Date = Convert.ToDateTime(Request_Date.Text);
                voucher.Recived_Date = Convert.ToDateTime(Recived_Date.Text);
                if (Payment_Way.SelectedItem.ToString() == "Cheque")
                {
                    voucher.Is_Cheque   = true;
                    voucher.Cheque_Date = Convert.ToDateTime(Cheque_dateDateEdit.Text);
                    voucher.Cheque_No   = Cheque_NoTextEdit.Text;
                    voucher.Cheque_Bank = ItemForCheque_Bank.Text;
                }
                else
                {
                    voucher.Is_Cheque = false;
                }
                //  voucher.deducted_from_salary = (bool)Voucher_Type.Properties.View.GetFocusedRowCellValue("deducted_from_salary");
                voucher.Amount = Convert.ToDecimal(amountTextEdit.Text);
            }
            return(voucher);
        }
Beispiel #3
0
        private void Load_form()
        {
            Emp_No.Text               = "";
            Emp_Name.Text             = "";
            Iqama_no.Text             = "";
            Voucher_Type.Text         = "";
            Voucher_Serial.Text       = "";
            txt_VoucherId.Text        = "";
            amountTextEdit.Text       = "";
            Cheque_BankTextEdit.Text  = "";
            Cheque_NoTextEdit.Text    = "";
            Cheque_dateDateEdit.Text  = DateTime.Now.ToShortDateString();
            Payment_Way.SelectedIndex = 0;
            var li = (from emp in linq.Tb_HrEmps
                      where emp.Is_deleted == false
                      select new { emp.EmpNo, emp.FullNameArab, emp.FullNameEng, emp.IqamaNo }).ToList();

            Emp_No.Properties.DataSource    = li;
            Emp_No.Properties.DisplayMember = "EmpNo";
            Emp_No.Properties.ValueMember   = "EmpNo";
            var types = (from type in linq.Vouchers_Types select new { type.id, type.Type, type.deducted_from_salary }).ToList();

            Voucher_Type.Properties.DataSource    = types;
            Voucher_Type.Properties.DisplayMember = "Type";
            Voucher_Type.Properties.ValueMember   = "id";

            Request_Date.Text = DateTime.Now.ToShortDateString();
            Recived_Date.Text = DateTime.Now.ToShortDateString();
            var        countOfRows = linq.Tb_Vouchers.Count();
            Tb_Voucher lastRow     = null;

            if (countOfRows > 0)
            {
                lastRow = linq.Tb_Vouchers.OrderBy(c => 1 == 1).Skip(countOfRows - 1).FirstOrDefault();
            }
            amountTextEdit.Text = "0";
            if (lastRow != null)
            {
                Voucher_Serial.Text = (lastRow.Serial + 1).ToString();
            }
            else
            {
                Voucher_Serial.Text = "1";
            }
            for (int i = 0; i < gridView2.RowCount;)
            {
                gridView2.DeleteRow(i);
            }
            //var v_id =(from v in linq.Tb_Vouchers
            //            where v.Emp_Id == Emp_No.Text
            //            select v).ToList().Count;
            //txt_VoucherId.Text = Emp_No.Text + "V_" + (v_id+1);
            //MessageBox.Show(linq.Tb_Vouchers.LongCount().ToString());
        }