Exemple #1
0
        }//---------------------------

        //###########################################END BUTTON btnClose EVENTS#####################################################

        //###########################################BUTTON btnClose EVENTS#####################################################
        //event is raised when the control is clicked
        private void btnPrintClick(object sender, EventArgs e)
        {
            try
            {
                using (AdministratorServices.ClassAdministratorServices.CrystalReport.CrystalTransaction rptTransaction =
                           new AdministratorServices.ClassAdministratorServices.CrystalReport.CrystalTransaction())
                {
                    rptTransaction.Database.Tables["transaction_table"].SetDataSource(_transactionDoneTable);
                    rptTransaction.SetParameterValue("@complete_name",
                                                     RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(_transactionLogInfo.UserInfo.PersonInfo.LastName,
                                                                                                          _transactionLogInfo.UserInfo.PersonInfo.FirstName, _transactionLogInfo.UserInfo.PersonInfo.MiddleName));
                    rptTransaction.SetParameterValue("@user_name", _transactionLogInfo.UserInfo.UserName);
                    rptTransaction.SetParameterValue("@access", _transactionLogInfo.AccessDescription);
                    rptTransaction.SetParameterValue("@transaction_date", _transactionLogInfo.TransactionDate);
                    rptTransaction.SetParameterValue("@network_information", _transactionLogInfo.NetworkInformation);
                    rptTransaction.SetParameterValue("@print_Info", "Date/Time Printed: " +
                                                     DateTime.Parse(_administrationManager.ServerDateTime).ToShortDateString() + " " +
                                                     DateTime.Parse(_administrationManager.ServerDateTime).ToShortTimeString() + "      Printed by: " +
                                                     RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(_userInfo.PersonInfo.LastName, _userInfo.PersonInfo.FirstName,
                                                                                                          _userInfo.PersonInfo.MiddleName));

                    using (RemoteClient.CrystalReportViewer frmViewer = new RemoteClient.CrystalReportViewer(rptTransaction))
                    {
                        frmViewer.Text = "Transaction Log";
                        frmViewer.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error Printing");
            }
        }//------------------------
Exemple #2
0
        //this procedure prints the employee deduction list
        public void PrintEmployeeDeductionList(CommonExchange.SysAccess userInfo, CommonExchange.Employee empInfo, DateTime dateFrom,
                                               DateTime dateTo)
        {
            DataTable reportTable = new DataTable("EarningDeduction");

            reportTable.Columns.Add("id", System.Type.GetType("System.Int64"));
            reportTable.Columns.Add("date_string", System.Type.GetType("System.String"));
            reportTable.Columns.Add("description", System.Type.GetType("System.String"));
            reportTable.Columns.Add("amount", System.Type.GetType("System.Decimal"));

            foreach (DataRow decRow in _decTableBySearch.Rows)
            {
                DataRow newRow = reportTable.NewRow();

                newRow["id"]          = decRow["deduction_id"];
                newRow["date_string"] = DateTime.Parse(decRow["deduction_date"].ToString()).ToShortDateString() + " " +
                                        DateTime.Parse(decRow["deduction_date"].ToString()).ToShortTimeString();
                newRow["description"] = decRow["deduction_description"];
                newRow["amount"]      = decRow["amount"];

                reportTable.Rows.Add(newRow);
            }

            reportTable.AcceptChanges();

            using (ClassEarningDeductionManager.CrystalReport.CrystalEmployeeEarningDeductionList rptDeduction =
                       new EmployeeServices.ClassEarningDeductionManager.CrystalReport.CrystalEmployeeEarningDeductionList())
            {
                rptDeduction.Database.Tables["earning_deduction"].SetDataSource(reportTable);

                rptDeduction.SetParameterValue("@school_name", CommonExchange.SchoolInformation.SchoolName);
                rptDeduction.SetParameterValue("@address", CommonExchange.SchoolInformation.Address);
                rptDeduction.SetParameterValue("@phone_nos", CommonExchange.SchoolInformation.PhoneNos);
                rptDeduction.SetParameterValue("@report_name", "Employee Deduction Summary");
                rptDeduction.SetParameterValue("@date_covered", "as of " + dateFrom.ToLongDateString() + " to " + dateTo.ToLongDateString());
                rptDeduction.SetParameterValue("@employee_id", empInfo.EmployeeId);
                rptDeduction.SetParameterValue("@employee_name", RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(empInfo.PersonInfo.LastName,
                                                                                                                      empInfo.PersonInfo.FirstName, empInfo.PersonInfo.MiddleName));
                rptDeduction.SetParameterValue("@printer_info", "Date/Time Printed: " + DateTime.Parse(_serverDateTime).ToShortDateString() + " " +
                                               DateTime.Parse(_serverDateTime).ToShortTimeString() + "      Printed by: " +
                                               RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(userInfo.PersonInfo.LastName, userInfo.PersonInfo.FirstName,
                                                                                                    userInfo.PersonInfo.MiddleName));
                rptDeduction.SetParameterValue("@total", "Total deductions-to-date:");

                using (RemoteClient.CrystalReportViewer frmViewer = new RemoteClient.CrystalReportViewer(rptDeduction))
                {
                    frmViewer.ShowDialog();
                }
            }
        } //-----------------------------------------
        //this procedure will print chart of Account
        public void PrintChartOfAccount(CommonExchange.SysAccess userInfo)
        {
            DataTable accountTable = new DataTable("Account Table");

            accountTable.Columns.Add("sysid_account", System.Type.GetType("System.String"));
            accountTable.Columns.Add("account_code", System.Type.GetType("System.String"));
            accountTable.Columns.Add("account_name", System.Type.GetType("System.String"));

            if (_chartOfAccountsTable != null)
            {
                foreach (DataRow accountRow in _chartOfAccountsTable.Rows)
                {
                    DataRow newRow = accountTable.NewRow();

                    newRow["sysid_account"] = RemoteServerLib.ProcStatic.DataRowConvert(accountRow, "sysid_account", String.Empty);
                    newRow["account_code"]  = RemoteServerLib.ProcStatic.DataRowConvert(accountRow, "account_code", String.Empty);
                    newRow["account_name"]  = RemoteServerLib.ProcStatic.DataRowConvert(accountRow, "account_name", String.Empty);

                    accountTable.Rows.Add(newRow);
                }
            }

            using (AccountingServices.ClassChartOfAccountManager.CrystalReport.CrystalChartOfAccount rptChartOfAccount =
                       new AccountingServices.ClassChartOfAccountManager.CrystalReport.CrystalChartOfAccount())
            {
                rptChartOfAccount.Database.Tables["account_table"].SetDataSource(accountTable);
                rptChartOfAccount.SetParameterValue("@school_name", CommonExchange.SchoolInformation.SchoolName);
                rptChartOfAccount.SetParameterValue("@form_name", "Chart of Accounts");
                rptChartOfAccount.SetParameterValue("@date_printed", DateTime.Parse(this.ServerDateTime).ToLongDateString());
                rptChartOfAccount.SetParameterValue("@print_Info", "Date/Time Printed: " +
                                                    DateTime.Parse(this.ServerDateTime).ToShortDateString() + " " +
                                                    DateTime.Parse(this.ServerDateTime).ToShortTimeString() + "      Printed by: " +
                                                    RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(userInfo.PersonInfo.LastName, userInfo.PersonInfo.FirstName,
                                                                                                         userInfo.PersonInfo.MiddleName));

                using (RemoteClient.CrystalReportViewer frmViewer = new RemoteClient.CrystalReportViewer(rptChartOfAccount))
                {
                    frmViewer.Text = "Chart of Account";
                    frmViewer.ShowDialog();
                }
            }
        }//----------------------------------