Пример #1
0
        void bttnMain_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0 || string.IsNullOrEmpty(values))
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else
            {
                if (Program.stateCode == "20")
                {
                    if (radioGroup1.EditValue == null)
                    {
                        Common.setMessageBox("Receipt Printing Options", Program.ApplicationName, 1);
                        return;
                    }
                    else
                    {
                        using (
                            FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false, Convert.ToInt32(radioGroup1.EditValue))
                        {
                            IDList = strCollectionReportID
                        })
                        {
                            frmMainFest.ShowDialog();
                        }
                    }
                }
                else
                {
                    using (
                        FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false)
                    {
                        IDList = strCollectionReportID
                    })
                    {
                        frmMainFest.ShowDialog();
                    }
                }
            }

            //using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false) { IDList = strCollectionReportID })
            //{

            //    frmMainFest.ShowDialog();
            //}
        }
Пример #2
0
        //private void GridView3_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        //{
        //    DevExpress.XtraGrid.Columns.GridColumn Col = e.Column;
        //    if (Col.Name == "colSN")
        //    { // without " before and after yourColName
        //        if (e.ListSourceRowIndex >= 0)
        //        {
        //            e.DisplayText = (e.ListSourceRowIndex + 1).ToString();
        //        }
        //    }
        //}

        void btnMain_Click(object sender, EventArgs e)
        {
            if (selection.SelectedCount == 0 || string.IsNullOrEmpty(values))
            {
                Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else
            {
                using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false)
                {
                    IDList = strCollectionReportID
                })
                {
                    frmMainFest.ShowDialog();
                }
            }
        }
Пример #3
0
        void btnMain_Click(object sender, EventArgs e)
        {
            if (dtn == null)
            {
                Common.setMessageBox("No Records Printing of Receipts", Program.ApplicationName, 3);
                return;
            }
            else
            {
                using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, values, criteria2, false)
                {
                    IDList = strCollectionReportID
                })
                {
                    frmMainFest.ShowDialog();
                }

                gridControl4.Enabled = false;
            }
        }
Пример #4
0
        public FrmMainFest()
        {
            InitializeComponent();

            publicInstance = this;

            publicStreetGroup = this;

            setImages();

            ToolStripEvent();

            iTransType = TransactionTypeCode.New;

            //Load += OnFormLoad;


            gbj = 0;
            SetReload();

            btnApply.Click += btnApply_Click;

            btnPrint.Click += btnPrint_Click;

            if (Program.UserID == "" || Program.UserID == null)
            {
                user = "******";
            }
            else
            {
                user = Program.UserID;
            }

            //generate number
            BatchNumber = String.Format("{0:d9}", (DateTime.Now.Ticks / 10) % 1000000000);
        }
Пример #5
0
        void bttn(object sender, EventArgs e)
        {
            if (sender == btnConfirm)
            {
                //loop the TableLayoutCellPaintEventArgs if reason is empty
                foreach (DataRow row in dtget.Rows)
                {
                    if ((row["Reasons"] is DBNull) || (row["Reasons"] == "") || (string.IsNullOrEmpty(Convert.ToString(row["Reasons"]))))
                    {
                        isEmpty = true;
                        Common.setMessageBox("Reason Can't be Empty", "Request Sending", 2); break;
                    }
                    else
                    {
                        using (WaitDialogForm form = new WaitDialogForm("Application Working...,Please Wait...", "Sending Request"))
                        {
                            try
                            {
                                using (var receiptsserv = new ReceiptService())
                                {
                                    dsreturn = receiptsserv.LogReceiptsReprintRequest((string)row["ReceiptNo"], (string)row["PaymentRefNumber"], string.Empty, Program.UserID, (string)row["Reasons"], "NONE", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, Program.stationCode);
                                }
                                isEmpty = false;
                            }
                            catch (Exception ex)
                            {
                                Common.setMessageBox(string.Format("{0}----{1}..Sending Request Reprint of Receipt Failed", ex.Message, ex.StackTrace), Program.ApplicationName, 3);
                                return;
                            }
                        }
                    }
                }

                if (!isEmpty)
                {
                    //get return message from online
                    if (dsreturn.Tables[0].Rows[0]["returnmessage"].ToString() == "-1")
                    {
                        Common.setMessageBox(dsreturn.Tables[0].Rows[0]["returnmessage1"].ToString(), Program.ApplicationName, 1);
                        return;
                    }
                    else
                    {
                        using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                        {
                            connect.Open();
                            _command = new SqlCommand("UpdateRequestSent", connect)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            _command.Parameters.Add(new SqlParameter("@status", SqlDbType.VarChar)).Value = "Sent";
                            _command.Parameters.Add(new SqlParameter("@tblCollectionReport_Temp", SqlDbType.Structured)).Value = dtget;

                            System.Data.DataSet response = new System.Data.DataSet();

                            adp = new SqlDataAdapter(_command);
                            adp.Fill(response);

                            connect.Close();
                            if (response.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                            {
                                Common.setMessageBox(response.Tables[0].Rows[0]["returnMessage"].ToString(), "Manifest", 2); return;
                            }
                            else
                            {
                                Common.setMessageBox("Request Sent for Approval..", Program.ApplicationName, 1);
                                Common.setMessageBox("Call your Admin Office for Record Aproval..,Click on Get Record Approval to get Record", Program.ApplicationName, 1);
                            }
                        }

                        return;
                    }
                }
            }
            else if (sender == btnMain)
            {
                using (FrmMainFest frmMainFest = new FrmMainFest(strCollectionReportID, criteria3, criteria2, true)
                {
                    IDList = strCollectionReportID
                })
                {
                    frmMainFest.ShowDialog();
                }
            }
            else if (sender == btnPrint)
            {
                if (selection.SelectedCount == 0)
                {
                    Common.setMessageBox("No Selection Made for Printing of Receipts", Program.ApplicationName, 3);
                    return;
                }
                else
                {
                    //criteria3 = GetPayRef();
                    using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                    {
                        SqlTransaction transaction;

                        db.Open();

                        transaction = db.BeginTransaction();

                        try
                        {
                            using (System.Data.DataSet dds = new System.Data.DataSet("DsCollectionReport"))
                            {
                                SqlDataAdapter ada;

                                using (WaitDialogForm form = new WaitDialogForm())
                                {
                                    string strFormat = null;

                                    query = string.Format("SELECT [ID] , [Provider] , [Channel] ,[PaymentRefNumber] , [DepositSlipNumber] , CONVERT(VARCHAR,CONVERT(DATETime,[PaymentDate])) AS PaymentDate,[PayerID] , UPPER([PayerName]) AS [PayerName], [Amount] ,[PaymentMethod] ,[ChequeNumber] ,[ChequeValueDate] ,[ChequeStatus] ,[DateChequeReturned] ,[TelephoneNumber] ,[ReceiptNo] ,[ReceiptDate] ,UPPER([PayerAddress]) as [PayerAddress] ,[Status] ,[User] ,[RevenueCode] ,[Description] , [ChequeBankCode] ,[ChequeBankName] ,[AgencyName] ,[AgencyCode] ,[BankCode] ,[BankName] ,[BranchCode] ,[BranchName] ,[ZoneCode] ,[ZoneName] ,[Username] ,[State] ,[AmountWords] ,[URL] ,[EReceipts] ,[EReceiptsDate] ,[GeneratedBy] ,[DateValidatedAgainst] ,[DateDiff] ,[UploadStatus] ,[PrintedBY] ,[DatePrinted] ,[ControlNumber] ,[BatchNumber] ,[StationCode] ,(Select StationName from tblStation2 WHERE tblStation2.StationCode = tblCollectionReport.[StationCode]) AS StationName from tblCollectionReport WHERE RevenueCode NOT IN (SELECT RevenueCode FROM [tblPrintingRevenueCode]) AND PaymentRefNumber IN (SELECT PaymentRefNumber FROM  [tblReceipt] where sentby ='{0}' AND Isprinted=0) AND EReceipts IN (SELECT ReceiptNo FROM  [tblReceipt]) ORDER BY tblCollectionReport.StationCode , tblCollectionReport.AgencyCode ,tblCollectionReport.RevenueCode,tblCollectionReport.EReceipts", Program.UserID);

                                    DataTable Dt = dds.Tables.Add("CollectionReportTable");
                                    ada = new SqlDataAdapter(query, Logic.ConnectionString);
                                    ada.Fill(dds, "CollectionReportTable");
                                    Logic.ProcessDataTable(Dt);;
                                    strCollectionReportID = strFormat;
                                }


                                XRepReceipt recportRec = new XRepReceipt {
                                    DataSource = dds /*recportRec.DataAdapter = ada;*/, DataMember = "CollectionReportTable"
                                };
                                recportRec.logoPath = Logic.singaturepth;
                                recportRec.ShowPreviewDialog();
                            }
                        }
                        catch (SqlException sqlError)
                        {
                            //transaction.Rollback();

                            Tripous.Sys.ErrorBox(sqlError);
                        }
                        catch (Exception ex)
                        {
                            Tripous.Sys.ErrorBox(ex);
                        }
                        db.Close();
                    }


                    btnMain.Enabled = true;

                    btnPrint.Enabled = false;

                    //btnSearch.Enabled = false;

                    gridControl4.Enabled = false;

                    //Common.setMessageBox(convert.tostring(DateTime.Now), Program.ApplicationName, 1);



                    //ask if the print was sucessfull
                    DialogResult result = MessageBox.Show(" Is Receipt Printing Successful ?", Program.ApplicationName, MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        //update the collection table by seting the isprinted to true
                        using (SqlConnection db = new SqlConnection(Logic.ConnectionString))
                        {
                            SqlTransaction transaction;

                            db.Open();

                            transaction = db.BeginTransaction();


                            try
                            {
                                string query1 = String.Format("UPDATE tblCollectionReport SET isPrinted=1,IsPrintedDate= '{0:MM/dd/yyyy HH:mm:ss tt}',PrintedBY='{1}' WHERE PaymentRefNumber IN (SELECT PaymentRefNumber FROM  [tblReceipt] where SentBy='{1}')", DateTime.Now, Program.UserID);

                                using (SqlCommand sqlCommand = new SqlCommand(query1, db, transaction))
                                {
                                    sqlCommand.ExecuteNonQuery();
                                }
                            }
                            catch (Exception ex)
                            {
                                transaction.Rollback();
                                Tripous.Sys.ErrorBox(ex);
                                return;
                            }
                            transaction.Commit();

                            db.Close();
                        }
                    }



                    //    //}
                    //    //else
                    //    //{
                    //    //    return;
                    //    //}
                }
                //else
                //    return;
            }
            else if (sender == btnGet)
            {
                try
                {
                    using (var receiptsserv = new ReceiptService())
                    {
                        dsGetapp = receiptsserv.GetReceiptReprintApproved(Program.stationCode);
                    }
                }
                catch (Exception ex)
                {
                    Common.setMessageBox(ex.StackTrace + ex.Message.ToString(), "Error", 3); return;
                }

                if (dsGetapp.Tables[0].Rows[0]["returnmessage"].ToString() == "-1")
                {
                    Common.setMessageBox(dsGetapp.Tables[0].Rows[0]["returnmessage1"].ToString(), Program.ApplicationName, 1);
                    return;
                }
                else
                {
                    if (dsGetapp.Tables.Count == 0 || dsGetapp.Tables[0].Rows.Count < 1)
                    {
                        Common.setMessageBox("No records have been approval yet", "Get Approval Record", 1);
                        return;
                    }
                    else
                    {
                        using (WaitDialogForm form = new WaitDialogForm("Application Working...,Please Wait...", "Getting Approval Records"))
                        {
                            //insert record into collection
                            dstretval = InsertData(dsGetapp);

                            //send return data online for update
                            try
                            {
                                using (var receiptsserv = new ReceiptService())
                                {
                                    dsGetappup = receiptsserv.UpdateReceiptReprintApproved(dstretval);
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                            if (dsGetappup.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                            {
                                iTransType = TransactionTypeCode.Edit;
                                voidgetRec(dstretval);
                                OnFormLoad(null, null); return;
                            }
                            else
                            {
                                Common.setMessageBox(string.Format("Error Updating Approval Record, {0}...", dsGetappup.Tables[0].Rows[0]["returnMessage"]), Program.ApplicationName, 3);
                                return;
                            }
                        }
                    }
                }
            }
        }