Example #1
0
        private string SetHeaderDatatoClass(out AccountTypes.Payment_GeneralDataType _SaveHeader)
        {
            _SaveHeader = new AccountTypes.Payment_GeneralDataType();
            try
            {

                _SaveHeader.AccountID = MyCommon.GetSelectedID(cmbFromAcc, true);
                _SaveHeader.ChequeNumber = cmbMethodObg.Text;
                _SaveHeader.Cr = decimal.Parse(txtToalAmountLKR.Text);
                _SaveHeader.CurRate = decimal.Parse(txtExRate.Text);
                _SaveHeader.Description = txtfromMemo.Text;
                _SaveHeader.FCr = decimal.Parse(txtToalAmountFCR.Text);
                _SaveHeader.PaymentID = txtPVNno.Text;
                _SaveHeader.PaymentMethod = int.Parse(MyCommon.GetSelectedID(cmbPayMethod, true));
                _SaveHeader.PayStatus = 0;
                _SaveHeader.TrUser = Program.AccountStatic.UserName;
                _SaveHeader.CompanyID = Program.AccountStatic.CompanyID;
                _SaveHeader.AccPeriod = Program.AccountStatic.CurrentAccPeriod;
                _SaveHeader.PayToCatID = int.Parse(MyCommon.GetSelectedID(cmbPayFor, true));
                _SaveHeader.PayToName = cmbPayTo.Text;
                _SaveHeader.PayActualDate = dtpPVNDate.Value;
                if (chkAsAdvancePayment.Checked)
                    _SaveHeader.IsAdvancePayment = 1;
                else
                    _SaveHeader.IsAdvancePayment = 0;

                List<AccountTypes.Payment_GeneralDetailsDataType> _SaveDetailList;
                string respond = SetDetailDataToClass(out _SaveDetailList);
                _SaveHeader.Details = _SaveDetailList;
                return "True";

            }
            catch (Exception ex)
            {

                return ex.Message;
            }
        }
Example #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to Update current record ? ", "Confirmation ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                int VoucherStatus = MyPay.GetPVNStatus(txtPVNno.Text);
                switch (VoucherStatus)
                {

                    case 3:
                        Program.InformationMessage("Already Accounted, cannot chage");
                        break;
                    default:
                        if (MyPay.ExistPayment_General(txtPVNno.Text))
                        {
                            AccountTypes.Payment_GeneralDataType _SaveHeader = new AccountTypes.Payment_GeneralDataType();
                            string respond = "";
                            string PVN = "";
                            string SelItem = MyCommon.GetSelectedID(cmbPayFor, true);
                            if (SelItem == "5")
                            {
                                MyAccount.SaveotherPayee(cmbPayTo.Text, lblAddress.Text);
                            }
                            respond = SetHeaderDatatoClass(out _SaveHeader);
                            if (respond == "True")
                            {

                                respond = MyPay.UpdatePayment_General(_SaveHeader);
                                if (respond == "True")
                                {
                                    LoadExtPaymentList();
                                    MessageBox.Show("Data Updated Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    txtPVNno.Text = "";
                                    Program.VerningMessage(respond);

                                }
                            }
                            else
                                Program.VerningMessage(respond);

                        }
                        else
                        {
                            Program.VerningMessage("Use Save Button");
                        }
                        break;
                }
            }
        }
Example #3
0
        public string GetExistPayment_General(string PaymentID, out  AccountTypes.Payment_GeneralDataType _ExistData)
        {
            _ExistData = new AccountTypes.Payment_GeneralDataType();
            MySqlCommand oSqlCommand = new MySqlCommand();
            string sqlQuery = "Select "
          + "PaymentID,"
          + "PaymentMethod,"
          + "Description,"
          + "AccountID,"
          + "CurRate,"
          + "Cr,"
          + "FCr,"
          + "PayStatus,"
          + "TrRef,"
          + "TrUser,"
          + "TrDate,"
          + "TrTime,"
          + "ChequeNumber,PayToCatID,PayToName,PayActualDate,AccPeriod,CompanyID,IsAdvancePayment"
          + " from tblpayment"
          + " Where 1=1 "
                + " and PaymentID=@PaymentID";
            oSqlCommand.Parameters.AddWithValue("@PaymentID", PaymentID);
            DataRow r = Mycommon.GetDataRowAccount(sqlQuery, oSqlCommand,  "Get Exist data Payment_General");
            if (r != null)
            {
                try
                {
                    bool resp = false;
                    _ExistData.PaymentID = r["PaymentID"].ToString();
                    int inPaymentMethod = 0;
                    resp = int.TryParse(r["PaymentMethod"].ToString(), out inPaymentMethod);
                    _ExistData.PaymentMethod = inPaymentMethod;
                    _ExistData.Description = r["Description"].ToString();
                  
                    _ExistData.AccountID = r["AccountID"].ToString();
                    decimal deCurRate = 0;
                    resp = decimal.TryParse(r["CurRate"].ToString(), out deCurRate);
                    _ExistData.CurRate = deCurRate;
                    decimal deCr = 0;
                    resp = decimal.TryParse(r["Cr"].ToString(), out deCr);
                    _ExistData.Cr = deCr;
                    decimal deFCr = 0;
                    resp = decimal.TryParse(r["FCr"].ToString(), out deFCr);
                    _ExistData.FCr = deFCr;
                    int inPayStatus = 0;
                    resp = int.TryParse(r["PayStatus"].ToString(), out inPayStatus);
                    _ExistData.PayStatus = inPayStatus;
                    _ExistData.TrRef = r["TrRef"].ToString();
                    _ExistData.TrUser = r["TrUser"].ToString();
                    DateTime dtTrDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["TrDate"].ToString(), out dtTrDate);
                    if (resp)
                        _ExistData.TrDate = dtTrDate;
                    else
                        _ExistData.TrDate = new DateTime(1900, 1, 1);
                    _ExistData.TrTime = r["TrTime"].ToString();
                    _ExistData.ChequeNumber = r["ChequeNumber"].ToString();
                    _ExistData.PayToName = r["PayToName"].ToString();
                    int inPayToCatID = 0;
                    resp = int.TryParse(r["PayToCatID"].ToString(), out inPayToCatID);
                    _ExistData.PayToCatID = inPayToCatID;

                    DateTime dtPayActualDate = new DateTime(1900, 1, 1);
                    resp = DateTime.TryParse(r["PayActualDate"].ToString(), out dtPayActualDate);
                    if (resp)
                        _ExistData.PayActualDate = dtPayActualDate;
                    else
                        _ExistData.PayActualDate = new DateTime(1900, 1, 1);

                    //AccPeriod

                    int inAccPeriod = 0;
                    resp = int.TryParse(r["AccPeriod"].ToString(), out inAccPeriod);
                    _ExistData.AccPeriod = inAccPeriod;

                    int inCompanyID = 0;
                    resp = int.TryParse(r["CompanyID"].ToString(), out inCompanyID);
                    _ExistData.CompanyID  = inCompanyID;
                    //IsAdvancePayment
                    int inIsAdvancePayment = 0;
                    resp = int.TryParse(r["IsAdvancePayment"].ToString(), out inIsAdvancePayment);
                    _ExistData.IsAdvancePayment = inIsAdvancePayment;

                    List<AccountTypes.Payment_GeneralDetailsDataType> _Exlist = new List<AccountTypes.Payment_GeneralDetailsDataType>();
                    string respond1 = GetPaymentDetailList(PaymentID, out _Exlist);
                    _ExistData.Details = _Exlist;
                    return "True";
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
            }
            else
                return "data not found ";
        }