Beispiel #1
0
        private string SetDataToPayBill(out BillingDataTypes.BillingDataType _SaveData)
        {
            MakeDueDate();
            _SaveData = new BillingDataTypes.BillingDataType();
            try
            {
                _SaveData.AccountID   = lblAccnumber.Text;
                _SaveData.AccPeriod   = Program.AccountStatic.CurrentAccPeriod;
                _SaveData.BillNo      = cmbGRN.Text;
                _SaveData.BillStatus  = 0;
                _SaveData.CompanyID   = Program.AccountStatic.CompanyID;
                _SaveData.Cr          = decimal.Parse(lblTotalLKR.Text);
                _SaveData.CurRate     = decimal.Parse(lblExchangerate.Text);
                _SaveData.Description = txtDescription.Text;
                _SaveData.FCr         = decimal.Parse(lblTotalUSD.Text);
                _SaveData.PayToCatID  = 0;
                //_SaveData.PayToID = int.Parse(MyCommon.GetSelectedID(cmbSupplier, true));
                //Edited by manjula
                _SaveData.PayToID     = Convert.ToInt32(supid);
                _SaveData.TobePayDate = DateTime.Parse(lblDueDate.Text);
                _SaveData.TrUser      = Program.AccountStatic.UserName;
                _SaveData.TrDate      = dtpInvoiceDate.Value;
                _SaveData.BillDate    = dtpBilingDate.Value;
                _SaveData.PONo        = dtpGRNDetals.Rows[0].Cells["PONo"].Value.ToString();

                List <BillingDataTypes.BillingDetailsDataType> _SaveDetails = new List <BillingDataTypes.BillingDetailsDataType>();
                string respond = SetPayBillDetails(out _SaveDetails);
                _SaveData.BillingDetails = _SaveDetails;
                return("True");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Beispiel #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)
     {
         ;
     }
     {
         BillingDataTypes.BillingDataType _SaveData = new BillingDataTypes.BillingDataType();
         string respond = SetDataToPayBill(out _SaveData);
         if (MyBill.ExistBilling(_SaveData.BillNo, _SaveData.PayToID))
         {
             if (respond == "True")
             {
                 respond = MyBill.Update(_SaveData);
                 if (respond == "True")
                 {
                     Program.InformationMessage("Record Updated Successfully");
                     LoadBillList(MyCommon.GetSelectedID(cmbSupplier, true));
                 }
                 else
                 {
                     Program.VerningMessage(respond);
                 }
             }
             else
             {
                 Program.VerningMessage(respond);
             }
         }
         else
         {
             Program.VerningMessage("Use Save Button to save new records");
         }
     }
 }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to Save current record ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                ;
            }
            {
                BillingDataTypes.BillingDataType _SaveData = new BillingDataTypes.BillingDataType();
                string respond = SetDataToPayBill(out _SaveData);
                if (!MyBill.ExistBilling(_SaveData.BillNo, _SaveData.PayToID))
                {
                    int BillStatus = -1;
                    int SupID      = Convert.ToInt32(supid);
                    BillStatus = MyBill.GetBillStatus(cmbGRN.Text, Convert.ToInt32(supid));
                    if (BillStatus == 0)
                    {
                        if (respond == "True")
                        {
                            respond = MyBill.Save(_SaveData);

                            if (respond == "True")
                            {
                                //Edit by manjula
                                //********************************* update tblmaterials
                                bool        res = false;
                                LINKPayment objList;


                                for (int i = 0; i < dtpGRNDetals.Rows.Count; i++)
                                {
                                    if (Convert.ToBoolean(dtpGRNDetals.Rows[i].Cells[0].Value) == true)
                                    {
                                        objList              = new LINKPayment();
                                        objList.Status       = 9;
                                        objList.GRNNo        = cmbGRN.SelectedValue.ToString();
                                        objList.MaterialCode = dtpGRNDetals.Rows[i].Cells["MaterialCode"].Value.ToString();

                                        res = objService.SetMaterialStatus(objList);
                                    }
                                }


                                Program.InformationMessage("Record saved successfully");
                                // LoadBillList(MyCommon.GetSelectedID(cmbSupplier, true));

                                LoadBillList(SupID.ToString());

                                //Added by manju
                                LINKPayment objLink = new LINKPayment();
                                objLink.SupName = cmbSupplier.SelectedValue.ToString();
                                objLink.Status  = 0;
                                LoadGRN(objLink);

                                dtpGRNDetals.Columns.Clear();
                                dtpGRNDetals.DataSource = null;
                            }
                            else
                            {
                                Program.VerningMessage(respond);
                            }
                        }
                        else
                        {
                            Program.VerningMessage(respond);
                        }
                    }
                    else
                    {
                        switch (BillStatus)
                        {
                        case 2:
                            Program.VerningMessage("You cannot chage any details of this bill , Tt is already approved");
                            break;

                        case 3:
                            Program.VerningMessage("You cannot chage any details of this bill, It is already accounted");
                            break;

                        default:
                            break;
                        }
                    }
                }
                else
                {
                    Program.VerningMessage("Use Update Button to update details");
                }
            }
        }