Example #1
0
        private void btnPostTpAcc_Click(object sender, EventArgs e)
        {
            int BillStatus = -1;

            if (MessageBox.Show("Do you want post to account ? ", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                MyTransaction = new AccountTranaction(Program.AccountStatic.LoggingAsLocal);
                // int SupID = int.Parse(MyCommon.GetSelectedID(cmbSupplier, true));
                //Edited by manjula
                string      SupName      = cmbSupplier.SelectedValue.ToString();
                string      CreditPeriod = "";
                LINKPayment objLink      = new LINKPayment();
                objLink.SupName = SupName;
                LINKPayment[] objSuppID = objService.GetCreditorFinalSupplier(objLink);

                if (objSuppID.Length > 0)
                {
                    supid        = objSuppID[0].SupplierID.ToString();
                    CreditPeriod = objSuppID[0].CreditPeriod.ToString();
                }

                int SupID = Convert.ToInt32(supid);

                BillStatus = MyBill.GetBillStatus(cmbGRN.Text, SupID);
                if (BillStatus == 2)
                {
                    string respond = ""; //
                    respond = MyTransaction.DoBillTransaction(_ExtData);
                    if (respond == "True")
                    {
                        respond = MyBill.BillAccount(cmbGRN.Text, Program.AccountStatic.UserName, SupID);

                        if (respond == "True")
                        {
                            Program.InformationMessage("Successfully  Approved");
                        }
                        else
                        {
                            Program.VerningMessage(respond);
                        }
                    }
                    else
                    {
                        Program.VerningMessage(respond);
                    }
                }
                else
                {
                    if (BillStatus == 0)
                    {
                        Program.VerningMessage("This is not send to approval !!!");
                    }
                    else if (BillStatus == 1)
                    {
                        Program.VerningMessage("This is not Approved Bill !!!");
                    }
                    else if (BillStatus == 3)
                    {
                        Program.VerningMessage("This Bill Already Accounted !!!");
                    }
                }
            }
        }