private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmAuditTrail", "Search"))
                {
                    return;
                }

                string _AuditTrailDisplayFields = "SELECT CONVERT(VARCHAR(12), [Date], 107) AS [Transaction Date], " +
                                                  "CONVERT(VARCHAR(12), [Date], 108) AS [Transaction Time], " +
                                                  "LogDescription AS [Log Description], Hostname AS [Computer Name] " +
                                                  "FROM audittrail ";
                string _AuditTrailWhereFields = " ORDER BY [Date] ASC;";
                loSearches.lAlias = "";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtAuditTrail = loCommon.getDataFromSearch(_AuditTrailDisplayFields + loSearches.lQuery + _AuditTrailWhereFields);
                    GlobalFunctions.refreshGrid(ref dgvAuditTrail, ldtAuditTrail);
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (!GlobalFunctions.checkRights("tsmAuditTrail", "Search"))
     {
         return;
     }
     try
     {
         string _AuditTrailDisplayFields = "SELECT DATE_FORMAT(`Date`,'%M %d, %Y') AS `TransactionDate`,DATE_FORMAT(`Date`,'%h:%i:%s %p') AS `Transaction Time`,LogDescription AS `Log Description`, Hostname AS `Computer Name` " +
                                           "FROM audittrail ";
         string __AuditTrailWhereFields = " ORDER BY `Date` ASC;";
         loSearches.lAlias = "";
         loSearches.ShowDialog();
         if (loSearches.lFromShow)
         {
             ldtAuditTrail = loCommon.getDataFromSearch(_AuditTrailDisplayFields + loSearches.lQuery + __AuditTrailWhereFields);
             GlobalFunctions.refreshGrid(ref dgvAuditTrail, ldtAuditTrail);
         }
     }
     catch (Exception ex)
     {
         MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close);
         mb.ShowDialog();
         return;
     }
 }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmUserGroup", "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                _DisplayFields = "SELECT Id,Description,Remarks " +
                                 "FROM usergroup ";
                _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                _Alias       = "";

                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvUserGroups, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmLoanApplication", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT la.LoanApplicationId AS `Loan Application Id`, " +
                                        "DATE_FORMAT(la.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "la.ApplicationStatus AS `Application Status`, " +
                                        "CONCAT(c.Lastname,', ',c.Firstname,' ',SUBSTRING(c.Middlename, 1, 1),'.') AS `Client Name`, " +
                                        "b.Description AS Branch,z.Description AS Zone, " +
                                        "CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ',e.Lastname) AS `Collector Name`, " +
                                        "p.Description AS Product,la.PaymentFrequency AS `Payment Frequency`, " +
                                        "la.Terms,la.InterestRate AS `Interest Rate`,la.ServiceFeeRate AS `Service Fee Rate`, " +
                                        "la.LoanAmount AS `Loan Amount`,la.InterestAmount AS `Interest Amount`, " +
                                        "la.ServiceFeeAmount AS `Service Fee Amount`,la.TotalAmountDue AS `Total Amount Due`, " +
                                        "la.InstallmentAmountDue AS `Installment Amount Due`, " +
                                        "preby.Username AS `Prepared By`,appby.Username AS `Approved By`, " +
                                        "DATE_FORMAT(la.DateApproved,'%m-%d-%Y') AS `Date Approved`, " +
                                        "disby.Username AS `Disapproved By`,DATE_FORMAT(la.DateDisapproved,'%m-%d-%Y') AS `Date Disapproved`, " +
                                        "la.DisapprovedReason AS `Disapproved Reason`,la.Remarks " +
                                        "FROM loanapplication la " +
                                        "LEFT JOIN `client` c " +
                                        "ON la.ClientId = c.Id " +
                                        "LEFT JOIN branch b " +
                                        "ON la.BranchId = b.Id " +
                                        "LEFT JOIN zone z " +
                                        "ON la.ZoneId = z.Id " +
                                        "LEFT JOIN collector col " +
                                        "ON la.CollectorId = col.Id " +
                                        "LEFT JOIN employee e " +
                                        "ON col.EmployeeId = e.Id " +
                                        "LEFT JOIN product p " +
                                        "ON la.ProductId = p.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON la.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` appby " +
                                        "ON la.ApprovedBy = appby.Id " +
                                        "LEFT JOIN `user` disby " +
                                        "ON la.DisapprovedBy = disby.Id ";
                string _WhereFields = " AND la.`Status` = 'Active' ORDER BY la.LoanApplicationId DESC;";
                loSearches.lAlias = "la.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtLoanApplication = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtLoanApplication);
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "ModeOfPayment":
                    _DisplayFields = "SELECT Id,`Code`,Description,`Default`,CashPayment AS ` Cash Payment`,Remarks " +
                                     "FROM modeofpayment ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Cashier":
                    _DisplayFields = "SELECT c.Id,c.`Code`,c.`Name`,u.Username,c.Remarks " +
                                     "FROM cashier c " +
                                     "LEFT JOIN `user` u " +
                                     "ON c.UserId = u.Id ";
                    _WhereFields = " AND c.`Status` = 'Active' ORDER BY c.`Name` ASC;";
                    _Alias       = "";
                    break;

                case "Discount":
                    _DisplayFields = "SELECT Id,`Code`,Description,`Type`,`Value`,Remarks " +
                                     "FROM discount ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery.Replace("Default", "`Default`") + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmSalesOrder", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT so.Id AS Id,DATE_FORMAT(so.`Date`,'%m-%d-%Y') AS `Date`, "+
				"so.Final,so.Cancel,so.Post,so.PQId AS `P.Q. Id`, "+
				"so.Reference,c.Name AS Customer,so.Terms, "+
				"DATE_FORMAT(so.`DueDate`,'%m-%d-%Y') AS `Due Date`, "+
				"so.Instructions,sp.Name AS `Sales Person`, "+
				"so.TotalSOQty AS `Total S.O. Qty`,so.TotalQtyOut AS `Total Qty Out`, "+
				"so.TotalQtyVariance AS `Total Qty Variance`, "+
				"so.TotalAmount AS `Total Amount`,so.RunningBalance AS `Running Balance`, "+
				"preby.Username AS `Prepared By`,finby.Username AS `Finalized By`, "+
				"DATE_FORMAT(so.DateFinalized,'%m-%d-%Y') AS `Date Finalized`, "+
				"canby.Username AS `Cancelled By`,so.CancelledReason AS `Cancelled Reason`, "+
                "DATE_FORMAT(so.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`, " +
				"posby.Username AS `Posted By`,DATE_FORMAT(so.DatePosted,'%m-%d-%Y') AS `Date Posted`, "+
				"so.Remarks "+
				"FROM salesorder so "+
				"LEFT JOIN customer c "+
				"ON so.CustomerId = c.Id "+
				"LEFT JOIN salesperson sp "+
				"ON so.SalesPersonId = sp.Id "+
				"LEFT JOIN `user` preby "+
				"ON so.PreparedBy = preby.Id "+
				"LEFT JOIN `user` finby "+
				"ON so.FinalizedBy = finby.Id "+
				"LEFT JOIN `user` canby "+
				"ON so.CancelledBy = canby.Id "+
				"LEFT JOIN `user` posby "+
				"ON so.PostedBy = posby.Id ";
                string _WhereFields = " AND so.`Status` = 'Active' ORDER BY so.Id DESC;";
                loSearches.lAlias = "so.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtSalesOrder = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtSalesOrder);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #7
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmPurchaseOrder", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT po.Id AS Id,DATE_FORMAT(po.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "po.Final,po.Cancel,po.Post,po.PRId AS `P.R. Id`, " +
                                        "po.Reference,s.Name AS Supplier,po.Terms, " +
                                        "DATE_FORMAT(po.DueDate,'%m-%d-%Y') AS `Due Date`,po.Instructions, " +
                                        "CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ', e.Lastname) AS `Requested By`, " +
                                        "DATE_FORMAT(po.DateNeeded,'%m-%d-%Y') AS `Date Needed`, " +
                                        "po.TotalPOQty AS `Total P.O. Qty`,po.TotalQtyIn AS `Total Qty In`,po.TotalQtyVariance AS `Total Qty Variance`, " +
                                        "po.TotalAmount AS `Total Amount`,po.RunningBalance AS `Running Balance`, " +
                                        "preby.Username AS `Prepared By`,finby.Username AS `Finalized By`, " +
                                        "DATE_FORMAT(po.DateFinalized,'%m-%d-%Y') AS `Date Finalized`, " +
                                        "canby.Username AS `Cancelled By`,po.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(po.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`,posby.Username AS `PostedBy`, " +
                                        "DATE_FORMAT(po.DatePosted,'%m-%d-%Y') AS `Date Posted`,po.Remarks " +
                                        "FROM purchaseorder po " +
                                        "LEFT JOIN supplier s " +
                                        "ON po.SupplierId = s.Id " +
                                        "LEFT JOIN employee e " +
                                        "ON po.RequestedBy = e.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON po.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` finby " +
                                        "ON po.FinalizedBy = finby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON po.CancelledBy = canby.Id " +
                                        "LEFT JOIN `user` posby " +
                                        "ON po.PostedBy = posby.Id ";
                string _WhereFields = " AND po.`Status` = 'Active' ORDER BY po.Id DESC;";
                loSearches.lAlias = "po.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtPurchaseOrder = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtPurchaseOrder);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmPriceQuotation", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT pq.Id AS Id,DATE_FORMAT(pq.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "pq.Approve,pq.Cancel,pq.SOId AS `S.O. Id`,pq.Reference, " +
                                        "c.Name AS Customer,pq.Terms,pq.Instructions, " +
                                        "DATE_FORMAT(pq.ValidUntil,'%m-%d-%Y') AS `Valid Until`, " +
                                        "sp.Name AS `Sales Person`,DATE_FORMAT(pq.ShipDate,'%m-%d-%Y') AS `Ship Date`, " +
                                        "pq.ShipVia AS `Ship Via`,pq.TotalQty AS `Total Qty`,pq.TotalAmount AS `Total Amount`, " +
                                        "preby.Username AS `Prepared By`,appby.Username AS `Approved By`, " +
                                        "DATE_FORMAT(pq.DateApproved,'%m-%d-%Y') AS `Date Approved`, " +
                                        "canby.Username AS `Cancelled By`,pq.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(pq.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`,pq.Remarks " +
                                        "FROM pricequotation pq " +
                                        "LEFT JOIN customer c " +
                                        "ON pq.CustomerId = c.Id " +
                                        "LEFT JOIN salesperson sp " +
                                        "ON pq.SalesPersonId = sp.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON pq.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` appby " +
                                        "ON pq.ApprovedBy = appby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON pq.CancelledBy = canby.Id ";
                string _WhereFields = " AND pq.`Status` = 'Active' ORDER BY pq.Id DESC;";
                loSearches.lAlias = "pq.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtPriceQuotation = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtPriceQuotation);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #9
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmPurchaseRequest", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT pr.Id AS Id,DATE_FORMAT(pr.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "pr.Approve,pr.Cancel,pr.POId AS `P.O. Id`,pr.Reference,s.Name AS Supplier,pr.Terms,pr.Instructions, " +
                                        "CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ', e.Lastname) AS `Requested BY`, " +
                                        "DATE_FORMAT(pr.`DateNeeded`,'%m-%d-%Y') AS `Date Needed`, " +
                                        "pr.TotalQty AS `Total Qty`,pr.TotalAmount AS `Total Amount`,preby.Username AS `Prepared BY`, " +
                                        "appby.Username AS `Approved BY`,DATE_FORMAT(pr.DateApproved,'%m-%d-%Y') AS `Date Approved`, " +
                                        "canby.Username AS `Cancelled BY`,pr.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(pr.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`, " +
                                        "pr.Remarks " +
                                        "FROM purchaserequest pr " +
                                        "LEFT JOIN supplier s " +
                                        "ON pr.SupplierId = s.Id " +
                                        "LEFT JOIN employee e " +
                                        "ON pr.RequestedBy = e.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON pr.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` appby " +
                                        "ON pr.ApprovedBy = appby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON pr.CancelledBy = canby.Id ";
                string _WhereFields = " AND pr.`Status` = 'Active' ORDER BY pr.Id DESC;";
                loSearches.lAlias = "pr.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtPurchaseRequest = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtPurchaseRequest);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmStockAdjustment", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT i.Id AS Id,DATE_FORMAT(i.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "i.Final,i.Cancel,i.`Type`,i.Reference,s.Name AS Supplier,c.Name AS Customer, " +
                                        "i.TotalQtyIn AS `Total Qty In`,i.TotalQtyOut AS `Total Qty Out`, " +
                                        "preby.Username AS `Prepared By`,finby.Username AS `Finalized By`, " +
                                        "DATE_FORMAT(i.DateFinalized,'%m-%d-%Y') AS `Date Finalized`, " +
                                        "canby.Username AS `Cancelled By`,i.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(i.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`,i.Remarks " +
                                        "FROM inventory i " +
                                        "LEFT JOIN supplier s " +
                                        "ON i.SupplierId = s.Id " +
                                        "LEFT JOIN customer c " +
                                        "ON i.CustomerId = c.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON i.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` finby " +
                                        "ON i.FinalizedBy = finby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON i.CancelledBy = canby.Id ";
                string _WhereFields = " AND i.`Status` = 'Active' AND (i.`Type` != 'Stock Receiving' AND i.`Type` != 'Stock Withdrawal' AND " +
                                      "i.`Type` != 'Stock Withdrawal - POS' AND i.`Type` != 'Stock Transfer In' AND i.`Type` != 'Stock Transfer Out') " +
                                      "ORDER BY i.Id DESC;";
                loSearches.lAlias = "i.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtInventory = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtInventory);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmStockTransferIn", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT i.Id AS Id,DATE_FORMAT(i.`Date`,'%m-%d-%Y') AS `Date`, " +
                                        "i.Final,i.Cancel,i.STOutId AS `S.T. Out Id`, " +
                                        "i.Reference,i.Reference,lf.`Description` AS `Location From`,lt.`Description` AS `Location To`, " +
                                        "i.TotalQtyIn AS `Total Qty In`, " +
                                        "preby.Username AS `Prepared By`,finby.Username AS `Finalized By`, " +
                                        "DATE_FORMAT(i.DateFinalized,'%m-%d-%Y') AS `Date Finalized`, " +
                                        "canby.Username AS `Cancelled By`,i.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(i.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`,i.Remarks " +
                                        "FROM inventory i " +
                                        "LEFT JOIN location lf " +
                                        "ON i.FromLocationId = lf.Id " +
                                        "LEFT JOIN location lt " +
                                        "ON i.ToLocationId = lt.Id " +
                                        "LEFT JOIN `user` preby " +
                                        "ON i.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` finby " +
                                        "ON i.FinalizedBy = finby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON i.CancelledBy = canby.Id ";
                string _WhereFields = " AND i.`Status` = 'Active' AND i.`Type` = 'Stock Transfer In' ORDER BY i.Id DESC;";
                loSearches.lAlias = "i.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtInventory = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtInventory);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmGeneralJournal", "Search"))
                {
                    return;
                }

                string _DisplayFields = "SELECT je.JournalEntryId AS Id,je.FinancialYear AS `F.Y.`, " +
                                        "je.Posted,je.Cancel,je.Journal,je.Form,je.VoucherNo AS `Voucher No.`, " +
                                        "DATE_FORMAT(je.DatePrepared,'%m-%d-%Y') AS `Date Prepared`,je.Explanation, " +
                                        "je.TotalDebit AS `Total Debit`,je.TotalCredit AS `Total Credit`, " +
                                        "je.Reference, " +
                                        "je.BegBal AS `Beg. Bal.`,je.Adjustment,je.ClosingEntry AS `Closing Entry`, " +
                                        "preby.Username AS `Prepared By`, " +
                                        "posby.Username AS `Posted By`,DATE_FORMAT(je.DatePosted,'%m-%d-%Y') AS `Date Posted`, " +
                                        "canby.Username AS `Cancelled By`,je.CancelledReason AS `Cancelled Reason`, " +
                                        "DATE_FORMAT(je.DateCancelled,'%m-%d-%Y') AS `Date Cancelled`,je.Remarks " +
                                        "FROM journalentry je " +
                                        "LEFT JOIN `user` preby " +
                                        "ON je.PreparedBy = preby.Id " +
                                        "LEFT JOIN `user` posby " +
                                        "ON je.PostedBy = posby.Id " +
                                        "LEFT JOIN `user` canby " +
                                        "ON je.CancelledBy = canby.Id ";
                string _WhereFields = " AND je.`Status` = 'Active' AND je.Journal = 'GJ' AND " +
                                      "je.FinancialYear = " + GlobalVariables.CurrentFinancialYear + " ORDER BY je.JournalEntryId DESC;";
                loSearches.lAlias = "je.";
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtJournalEntry = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvList, ldtJournalEntry);

                    viewDetails();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #13
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "User":
                    _DisplayFields = "SELECT u.Id,u.Username,CONCAT(Firstname,' ',SUBSTRING(Middlename, 1, 1),'. ', Lastname) AS `Employee Name`, " +
                                     "ug.Description AS `User Group`,u.Remarks " +
                                     "FROM `user` u " +
                                     "LEFT JOIN employee e " +
                                     "ON u.EmployeeId = e.Id " +
                                     "LEFT JOIN usergroup ug " +
                                     "ON u.UserGroupId = ug.Id  ";
                    _WhereFields = " AND u.`Status` = 'Active' ORDER BY u.username ASC;";
                    _Alias       = "u.";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "Employee":
                    _DisplayFields = "SELECT b.[CODE],c.[Name] AS Company,b.[Description], " +
                                     "b.AccountNo AS [Account No.],b.EmailAddress AS [Email Address], " +
                                     "b.ContactPerson AS [Contact Person],b.Remarks " +
                                     "FROM bank b " +
                                     "LEFT JOIN company c " +
                                     "ON b.Company = c.Code ";
                    _WhereFields = " AND b.[Status]='Active' ORDER BY b.[Code] asc;";
                    _Alias       = "b.";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #15
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (!GlobalFunctions.checkRights("tsmStockAdjustment", "Search"))
     {
         return;
     }
     try
     {
         string _DisplayFields = "SELECT ih.HeaderId AS `Id`,DATE_FORMAT(ih.`Date`,'%m-%d-%Y') AS `Date`,ih.Type,ih.Final, " +
                                 "ih.Reference,s.Name AS `Supplier`,c.Name AS `Customer`,ih.TotalIn AS `Total Qty-IN`,ih.TotalOUT AS `Total Qty-OUT`, " +
                                 "ih.TotalAmount AS `Total Amount`, " +
                                 "ih.Username AS `Adjusted By`,DATE_FORMAT(ih.FinalDate,'%m-%d-%Y') AS `Final Date`, " +
                                 "ih.FinalizedBy AS `Finalized By`,ih.Remarks " +
                                 "FROM inventoryheader ih " +
                                 "LEFT JOIN customer c " +
                                 "ON ih.CustomerId = c.Id " +
                                 "LEFT JOIN supplier s " +
                                 "ON ih.SupplierId = s.Id ";
         string _WhereFields = " AND ih.`Status` = 'Active' AND ih.Type = 'Stock Adjustment' ORDER BY ih.HeaderId DESC;";
         loSearches.lAlias = "ih.";
         loSearches.ShowDialog();
         if (loSearches.lFromShow)
         {
             ldtStockAdjustment = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
             GlobalFunctions.refreshGrid(ref dgvList, ldtStockAdjustment);
             dgvDetails.DataSource = null;
             try
             {
                 ldtStockAdjustmentDetail = loInventoryDetail.getAllData(dgvList.CurrentRow.Cells[0].Value.ToString());
                 dgvDetails.DataSource    = ldtStockAdjustmentDetail;
             }
             catch { }
         }
     }
     catch (Exception ex)
     {
         MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close);
         mb.ShowDialog();
         return;
     }
 }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "Employee":
                    _DisplayFields = "SELECT e.Id,e.EmployeeNo AS `Employee No.`,e.Lastname, e.Firstname, e.Middlename, " +
                                     "e.EmailAddress AS `Email Address`,CONCAT(s.Firstname,' ',SUBSTRING(s.Middlename,1,1),'. ',s.Lastname) AS Supervisor,e.Remarks " +
                                     "FROM employee e " +
                                     "LEFT JOIN employee s " +
                                     "ON e.Supervisor = s.Id ";
                    _WhereFields = " AND e.Status = 'Active' ORDER BY e.Lastname,e.Firstname ASC;";
                    _Alias       = "e.";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "ProcurementDiscount":
                    _DisplayFields = "SELECT Id,`Code`,Description,`Type`,`Value`,Remarks " +
                                     "FROM procurementdiscount";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "ChartOfAccount":
                    _DisplayFields = "SELECT coa.Id, coa.Code, c.Description AS Classification, " +
                                     "sc.Description AS `Sub Classification`,ma.Description AS `Main Account`, " +
                                     "coa.AccountTitle AS `Account Title`,coa.TypeOfAccount AS `Type of Account`, " +
                                     "coa.Subsidiary,coa.ContraAccount AS `Contra Account`,coa.Remarks " +
                                     "FROM chartofaccount coa " +
                                     "LEFT JOIN classification c " +
                                     "ON coa.ClassificationId = c.Id " +
                                     "LEFT JOIN subclassification sc " +
                                     "ON coa.SubClassificationId = sc.Id " +
                                     "LEFT JOIN mainaccount ma " +
                                     "ON coa.MainAccountId = ma.Id ";
                    _WhereFields = " AND coa.`Status` = 'Active' ORDER BY coa.AccountTitle ASC;";
                    _Alias       = "coa.";
                    break;

                case "MainAccount":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM mainaccount ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Classification":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM classification ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "SubClassification":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM subclassification ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Bank":
                    _DisplayFields = "SELECT Id,`Code`,Description,AccountNo AS `Account No.`,EmailAddress AS `Email Address`, " +
                                     "ContactPerson AS `Contact Person`, Remarks " +
                                     "FROM bank ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Equipment":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM equipment ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Building":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM building ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #19
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "Customer":
                    _DisplayFields = "SELECT Id,`Name`,`Default`,Address,DATE_FORMAT(Birthdate,'%m-%d-%Y') AS Birthdate,TIN, " +
                                     "ContactPerson AS `Contact Person`,ContactNo AS `Contact No.`, " +
                                     "EmailAddress AS `Email Address`,Remarks " +
                                     "FROM customer ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY `Name` ASC;";
                    _Alias       = "";
                    break;

                case "Supplier":
                    _DisplayFields = "SELECT Id,`Name`,Address,TIN, " +
                                     "ContactPerson AS `Contact Person`,ContactNo AS `Contact No.`, " +
                                     "EmailAddress AS `Email Address`,BankName AS `Bank Name`, " +
                                     "BankAccountNo AS `Bank Account No.`,Remarks " +
                                     "FROM supplier ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY `Name` ASC;";
                    _Alias       = "";
                    break;

                case "InventoryGroup":
                    _DisplayFields = "SELECT Id,Description,Remarks " +
                                     "FROM inventorygroup ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Category":
                    _DisplayFields = "SELECT c.Id,c.Description,ig.Description AS `Inventory Group`,c.Remarks " +
                                     "FROM category c " +
                                     "LEFT JOIN inventorygroup ig " +
                                     "ON c.InventoryGroupId = ig.Id ";
                    _WhereFields = " AND c.`Status` = 'Active' ORDER BY c.Description ASC;";
                    _Alias       = "c.";
                    break;

                case "Stock":
                    _DisplayFields = "SELECT s.Id,s.Code,s.Description,c.Description AS `Category`, " +
                                     "u.Description AS Unit,s.UnitCost AS `Unit Cost`, " +
                                     "s.BasePrice AS `Base Price`,s.UnitPrice AS `Unit Price`, " +
                                     "s.ReorderLevel AS `Reorder Level`,s.Active,s.Saleable, " +
                                     "s.NonInventory AS `Non-Inventory`,s.Remarks " +
                                     "FROM stock s " +
                                     "LEFT JOIN category c " +
                                     "ON s.CategoryId = c.Id " +
                                     "LEFT JOIN unit u " +
                                     "ON s.UnitId = u.Id ";
                    _WhereFields = " AND s.`Status` = 'Active' ORDER BY s.Description ASC;";
                    _Alias       = "s.";
                    break;

                case "Unit":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM unit ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "InventoryType":
                    _DisplayFields = "SELECT Id,Description,Qty,Source,Remarks " +
                                     "FROM inventorytype ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;

                case "Location":
                    _DisplayFields = "SELECT Id,`Code`,Description,Remarks " +
                                     "FROM location ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Search"))
                {
                    return;
                }

                string _DisplayFields = "";
                string _WhereFields   = "";
                string _Alias         = "";

                switch (lType.Name)
                {
                case "Client":
                    _DisplayFields = "SELECT Id,Lastname,Firstname,Middlename,Nickname,CellphoneNo AS `Cellphone No.`, " +
                                     "DATE_FORMAT(Birthday,'%m-%d-%Y') AS `Date`, " +
                                     "SitioPurokStreet AS `Sitio/Purok/Street`,Barangay,TownCity AS `Town/City`, " +
                                     "Province,YearsOfStay AS `Years of Stay`,HomeType AS `Home Type`,Remarks " +
                                     "FROM `client` ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Lastname,Firstname ASC;";
                    _Alias       = "";
                    break;

                case "Area":
                    _DisplayFields = "SELECT a.Id,a.Code,a.Description, " +
                                     "CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ',e.Lastname) AS `Area Manager`,a.Remarks " +
                                     "FROM `area` a " +
                                     "LEFT JOIN employee e " +
                                     "ON a.AreaManager = e.Id ";
                    _WhereFields = " AND a.Status = 'Active' ORDER BY a.Description ASC;";
                    _Alias       = "";
                    break;

                case "Branch":
                    _DisplayFields = "SELECT b.Id,b.Code,b.Description,a.Description AS `Area`, " +
                                     "CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ',e.Lastname) AS `Branch Manager`,b.Remarks " +
                                     "FROM branch b " +
                                     "LEFT JOIN `area` a " +
                                     "ON b.AreaId = a.Id " +
                                     "LEFT JOIN employee e " +
                                     "ON b.BranchManager = e.Id ";
                    _WhereFields = " AND b.Status = 'Active' ORDER BY b.Description ASC;";
                    _Alias       = "";
                    break;

                case "Zone":
                    _DisplayFields = "SELECT z.Id,z.Description,b.Description AS `Branch`,z.Remarks " +
                                     "FROM zone z " +
                                     "LEFT JOIN branch b " +
                                     "ON z.BranchId = b.Id ";
                    _WhereFields = " AND z.Status = 'Active' ORDER BY z.Description ASC;";
                    _Alias       = "";
                    break;

                case "Collector":
                    _DisplayFields = "SELECT c.Id,CONCAT(e.Firstname,' ',SUBSTRING(e.Middlename, 1, 1),'. ',e.Lastname) AS `Employee Name`, " +
                                     "b.Description AS Branch, c.Remarks " +
                                     "FROM collector c " +
                                     "LEFT JOIN employee e " +
                                     "ON c.EmployeeId = e.Id " +
                                     "LEFT JOIN branch b " +
                                     "ON c.BranchId = b.Id ";
                    _WhereFields = " AND c.Status = 'Active' ORDER BY e.Firstname ASC;";
                    _Alias       = "";
                    break;

                case "Product":
                    _DisplayFields = "SELECT Id,`Code`,Description,PaymentFrequency AS `Payment Frequency`, " +
                                     "Terms,InterestRate AS `Interest Rate`,ServiceFeeRate AS `Service Fee Rate`,Remarks " +
                                     "FROM product ";
                    _WhereFields = " AND `Status` = 'Active' ORDER BY Description ASC;";
                    _Alias       = "";
                    break;
                }
                loSearches.lAlias = _Alias;
                loSearches.ShowDialog();
                if (loSearches.lFromShow)
                {
                    ldtShow = loCommon.getDataFromSearch(_DisplayFields + loSearches.lQuery + _WhereFields);
                    GlobalFunctions.refreshGrid(ref dgvLists, ldtShow);
                    lFromRefresh = false;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSearch_Click");
                em.ShowDialog();
                return;
            }
        }