Beispiel #1
0
        void Processwork()
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection made", Program.ApplicationName, 3);
                return;
            }
            else
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["Period"], (selection.GetSelectedRow(i) as DataRowView)["Narriation"], Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["BankAccountID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["SummaryID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"]), (selection.GetSelectedRow(i) as DataRowView)["AgencyCode"], (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"],
                                                       (selection.GetSelectedRow(i) as DataRowView)["Description"], (selection.GetSelectedRow(i) as DataRowView)["AgencyName"], Convert.ToDecimal((selection.GetSelectedRow(i) as DataRowView)["Amount"]) });
                }

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("doSummaryAGPosting", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                    _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                    _command.CommandTimeout = 0;

                    using (System.Data.DataSet ds = new System.Data.DataSet())
                    {
                        ds.Clear();
                        adp = new SqlDataAdapter(_command);
                        adp.Fill(ds);
                        connect.Close();

                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                            return;
                        }
                        else
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                            //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                            using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                            {
                                frmreport.ShowDialog();
                            }
                            //FrmRequest_Load(null, null);

                            setReload();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        void btnPost_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                if (dt != null && dt.Rows.Count > 0)
                {
                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("doSummaryAGPosting", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = dt;
                        _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                return;
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                                using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                                {
                                    frmreport.ShowDialog();
                                }
                                //FrmRequest_Load(null, null);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Beispiel #3
0
        void Init()
        {
            SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);


            publicStreetGroup = this;

            setImages();

            ToolStripEvent();

            Load += OnFormLoad;

            OnFormLoad(null, null);

            btnPrint.Click += btnPrint_Click;

            SplashScreenManager.CloseForm(false);
        }
Beispiel #4
0
        void btnAllocate_Click(object sender, EventArgs e)
        {
            if (gridView1.SelectedRowsCount == 0)
            {
                Common.setMessageBox("Select Record to Close", "Close Period", 1); return;
            }
            else
            {
                //Common.setMessageBox("Sorry TransactionPosting Suspend for now!", "Close Period", 1);
                //return;
                try
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

                    tableTrans.Clear();

                    if (string.IsNullOrEmpty(selection.SelectedCount.ToString()))
                    {
                        return;
                    }

                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        bool chkUpdate = (bool)(selection.GetSelectedRow(i) as DataRowView)["IsApproved"];
                        //BankAccountID,PostingRequestID
                        if (chkUpdate)
                        {
                            tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["BankShortCode"], (selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"], (selection.GetSelectedRow(i) as DataRowView)["StartDate"], (selection.GetSelectedRow(i) as DataRowView)["EndDate"], (selection.GetSelectedRow(i) as DataRowView)["BankAccountID"], (selection.GetSelectedRow(i) as DataRowView)["PostingRequestID"], (selection.GetSelectedRow(i) as DataRowView)["ReconID"] });
                        }
                    }


                    if (tableTrans.Rows.Count <= 0)
                    {
                        Common.setMessageBox("No approved record is selected", "Close Period", 3);
                        return;
                    }

                    selection.ClearSelection();

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("PostingTransactionApprove", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                        _command.CommandTimeout = 0;
                        //_command.Parameters.Add(new SqlParameter("@enddate", SqlDbType.VarChar)).Value = string.Format("{0:yyyy/MM/dd}", dtpEnd.Value);
                        //_command.Parameters.Add(new SqlParameter("@pType", SqlDbType.Bit)).Value = boolIsUpdate2;
                        //_command.Parameters.Add(new SqlParameter("@Batchcode", SqlDbType.Char)).Value = label22.Text;
                        //@Years
                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            //&& ds.Tables[0].Rows[0]["returnCode"].ToString() != "01"
                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00" && ds.Tables[0].Rows[0]["returnCode"].ToString() != "01")
                            {
                                if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "-1")
                                {
                                    Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                    return;
                                }
                                if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "-2")
                                {
                                    Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                    using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                                    {
                                        frmreport.ShowDialog();
                                    }
                                    FrmRequest_Load(null, null);

                                    //return;
                                }
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                if (ds.Tables.Count > 1)
                                {                                 //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                                    using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                                    {
                                        frmreport.ShowDialog();
                                    }
                                }
                                FrmRequest_Load(null, null);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tripous.Sys.ErrorBox(ex.Message); return;
                }
                finally
                {
                    SplashScreenManager.CloseForm(false);
                }
            }
        }