<?php
/**
* Created by PhpStorm.
* User: ehsan_pc
* Date: 3/14/2016
* Time: 4:22 PM
*/
namespace ApplicationBundle\Modules\System;
use ApplicationBundle\Constants\AccountsConstant;
use ApplicationBundle\Constants\ApprovalConstant;
use ApplicationBundle\Constants\GeneralConstant;
use ApplicationBundle\Entity\Approval;
use ApplicationBundle\Entity\Employee;
use ApplicationBundle\Entity\EmployeeDetails;
use ApplicationBundle\Entity\EmployeeLeaveApplication;
use ApplicationBundle\Entity\EntityApprovalActionLog;
use ApplicationBundle\Entity\NocApproval;
use ApplicationBundle\Entity\Signature;
use ApplicationBundle\Entity\SystemNotice;
use ApplicationBundle\Entity\SysUser;
use ApplicationBundle\Helper\Generic;
use ApplicationBundle\Modules\Accounts\Accounts;
use ApplicationBundle\Modules\Authentication\Constants\UserConstants;
use ApplicationBundle\Modules\Api\Constants\ApiConstants;
use ApplicationBundle\Modules\Buddybee\Buddybee;
use ApplicationBundle\Modules\User\Users;
use CompanyGroupBundle\Entity\EntityApplicantDetails;
use CompanyGroupBundle\Entity\EntityInvoice;
use CompanyGroupBundle\Entity\EntityNotification;
use Google_Client;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Generator\UrlGenerator;
class System
{
public static function strtohex($x)
{
$s = '';
foreach (str_split($x) as $c)
$s .= sprintf("%02X", ord($c));
return ($s);
}
public static function initiateDatabaseLocal($em)
{
}
public static function initiateAdminLocal($em)
{
}
public static function prePopulateDatabase($em)
{
$get_kids_sql = "
INSERT INTO `acc_accounts_head` (`accounts_head_id`, `parent_id`, `replication_head_id`, `replicate`, `advance_tagged`, `advance_of`, `name`, `path_tree`, `head_level`, `type`, `head_nature`, `cc_enabled`, `opening_balance`, `current_balance`, `current_balance_reconciled`, `company_id`, `ledger_head_code`, `edit_flag`, `delete_flag`, `lock_flag`, `refresh_flag`, `disabled_flag`, `marker_hash`, `cost_centre_types`, `narration_on_check`, `created_login_id`, `edited_login_id`, `created_user_id`, `edited_user_id`, `created_sig_id`, `edited_sig_id`) VALUES
(1, 0, NULL, NULL, NULL, NULL, 'Assets', '/', 1, 'ast', 'dr', 0, '9000', '17827926.411478', '16737911.591478', 1, '1474723560', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, 0, NULL, NULL, NULL, NULL, 'Equity and Liability', '/', 1, 'ast', 'cr', 0, '9000', '11642357.01', '9206052.99', 1, '1474723546', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(4, 0, NULL, NULL, NULL, NULL, 'Revenue', '/', 1, 'inc', 'cr', 0, '0', '16671219.403', '16479448.603', 1, '1474723566', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5, 0, NULL, NULL, NULL, NULL, 'Expense', '/', 1, 'exp', 'dr', 0, '0', '10748850.546522', '9180790.5465217', 1, '1474723583', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(89, 1, NULL, NULL, NULL, NULL, 'Fixed Assets', '/1/', 2, 'ast', 'dr', 0, '0', '73750', '72000', 1, '1474879117', NULL, NULL, NULL, NULL, NULL, '_NCASP_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(90, 1, NULL, NULL, NULL, NULL, 'Current Assets', '/1/', 2, 'ast', 'dr', 0, '9000', '17754176.411478', '16665911.591478', 1, '1474879099', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(94, 3, NULL, NULL, NULL, NULL, 'Equity', '/3/', 2, 'lib', 'cr', 0, '9000', '13085', '13095', 1, '1474879330', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(95, 3, NULL, NULL, NULL, NULL, 'Liabilities', '/3/', 2, 'lib', 'cr', 0, '0', '11629272.01', '9192957.99', 1, '1474879294', NULL, NULL, NULL, NULL, NULL, '_CASP_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(96, 94, NULL, NULL, NULL, NULL, 'Capital', '/3/94/', 3, 'lib', 'cr', 0, '9000', '13095', '13095', 1, '1474879440', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(97, 94, NULL, NULL, NULL, NULL, 'Reserves', '/3/94/', 3, 'lib', 'cr', 0, '0', '-10', '0', 1, '1474879493', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(98, 94, NULL, NULL, NULL, NULL, 'Retained earnings', '/3/94/', 3, 'lib', 'cr', 0, '0', '0', '0', 1, '1474879433', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(99, 95, NULL, NULL, NULL, NULL, 'Non-Current Liabilities', '/3/95/', 3, 'lib', 'cr', 0, '0', '1800000', '0', 1, '1474879470', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(100, 95, NULL, NULL, NULL, NULL, 'Current Liabilities', '/3/95/', 3, 'lib', 'cr', 0, '0', '9829272.01', '9192957.99', 1, '1474879541', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(101, 4, NULL, NULL, NULL, NULL, 'Operating Revenue', '/4/', 2, 'inc', 'cr', 0, '0', '16411448.603', '16411448.603', 1, '1474880972', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(102, 4, NULL, NULL, NULL, NULL, 'Non Operating Revenue', '/4/', 2, 'inc', 'cr', 0, '0', '0', '0', 1, '1474881043', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(103, 5, NULL, NULL, NULL, NULL, 'Direct Expenses', '/5/', 2, 'exp', 'dr', 0, '0', '158776.95652174', '158776.95652174', 1, '1474881081', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(104, 5, NULL, NULL, NULL, NULL, 'Operating Expenses', '/5/', 2, 'exp', 'dr', 0, '0', '10541802.58', '8973742.58', 1, '1474881107', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(105, 5, NULL, NULL, NULL, NULL, 'Non-Operating Expenses', '/5/', 2, 'exp', 'dr', 0, '0', '5997.01', '5997.01', 1, '1474881114', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(106, 89, NULL, NULL, NULL, NULL, 'Property, Plant and Equipment', '/1/89/', 3, 'ast', 'dr', 0, '0', '73750', '72000', 1, '1474881203', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(107, 89, NULL, NULL, NULL, NULL, ' Intangible Assets', '/1/89/', 3, 'ast', 'dr', 0, '0', '0', '0', 1, '1474881295', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(108, 89, NULL, NULL, NULL, NULL, ' Investments', '/1/89/', 3, 'ast', 'dr', 0, '0', '0', '0', 1, '1474881252', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(109, 90, NULL, NULL, NULL, NULL, ' Inventories', '/1/90/', 3, 'ast', 'dr', 0, '9000', '1553042.3334783', '1553042.3334783', 1, '1474881318', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(110, 90, NULL, NULL, NULL, NULL, 'Accounts Receivable', '/1/90/', 3, 'ast', 'dr', 0, '0', '17691572.108', '16575365.108', 1, '1474881341', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(111, 110, NULL, NULL, NULL, NULL, 'Receivable from Inter Company', '/1/90/110/', 4, 'ast', 'dr', 0, '0', '9721620.763', '8040127.763', 1, '1474881424', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(112, 90, NULL, NULL, NULL, NULL, 'Advance, Deposit & Prepayments', '/1/90/', 3, 'ast', 'dr', 0, '0', '812127.51', '-655050.49', 1, '1474881393', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(113, 90, NULL, NULL, NULL, NULL, 'Project in Progress', '/1/90/', 3, 'ast', 'dr', 0, '0', '0', '0', 1, '1474881442', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(114, 90, NULL, NULL, NULL, NULL, 'Cash and Cash Equivalent', '/1/90/', 3, 'ast', 'dr', 0, '0', '-2302565.54', '-807445.36', 1, '1474881706', NULL, NULL, NULL, NULL, NULL, '_CACEP_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(115, 99, NULL, NULL, NULL, NULL, 'Long Term Loan', '/3/95/99/', 4, 'lib', 'cr', 0, '0', '1800000', '0', 1, '1474882238', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(116, 99, NULL, NULL, NULL, NULL, 'Finance Lease', '/3/95/99/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1474882259', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(117, 100, NULL, NULL, NULL, NULL, 'Provision for GRN', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '2000', '2000', 1, '1474882395', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(118, 100, NULL, NULL, NULL, NULL, 'Advance & Deposit Received', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1474882358', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(119, 100, NULL, NULL, NULL, NULL, 'Short Term Loan', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '11563241.5', '1506112.5', 1, '1474882892', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(120, 100, NULL, NULL, NULL, NULL, ' Intercompany Loan', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1474882954', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(121, 100, NULL, NULL, NULL, NULL, 'Accounts Payable', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '-1623546.98', '479488', 1, '1474882966', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(122, 100, NULL, NULL, NULL, NULL, ' Accu. Depreciation of Fixed Assets', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1474883099', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(123, 101, NULL, NULL, NULL, NULL, 'Sales', '/4/101/', 3, 'inc', 'cr', 0, '0', '16411448.603', '16411448.603', 1, '1474883105', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(124, 102, NULL, NULL, NULL, NULL, 'Interest Income', '/4/102/', 3, 'inc', 'cr', 0, '0', '0', '0', 1, '1474883143', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(125, 102, NULL, NULL, NULL, NULL, ' Other income', '/4/102/', 3, 'inc', 'cr', 0, '0', '0', '0', 1, '1474883153', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(126, 103, NULL, NULL, NULL, NULL, 'Cost of Goods Sold', '/5/103/', 3, 'exp', 'dr', 0, '0', '158776.95652174', '158776.95652174', 1, '1474883307', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(127, 103, NULL, NULL, NULL, NULL, 'Project Expense', '/5/103/', 3, 'exp', 'dr', 0, '0', '0', '0', 1, '1474883290', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(129, 104, NULL, NULL, NULL, NULL, 'Administrative Expenses', '/5/104/', 3, 'exp', 'dr', 0, '0', '10118765.58', '8550705.58', 1, '1474884817', NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(130, 104, NULL, NULL, NULL, NULL, 'Selling and Distribution Expenses', '/5/104/', 3, 'exp', 'dr', 0, '0', '366667', '366667', 1, '1474884882', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(131, 104, NULL, NULL, NULL, NULL, 'Marketing and Promotional Expenses', '/5/104/', 3, 'exp', 'dr', 0, '0', '26490', '26490', 1, '1474884916', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(132, 105, NULL, NULL, NULL, NULL, ' Financial Expenses', '/5/105/', 3, 'exp', 'dr', 0, '0', '5997.01', '5997.01', 1, '1474884919', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(133, 105, NULL, NULL, NULL, NULL, 'Tax Expenses', '/5/105/', 3, 'exp', 'dr', 0, '0', '0', '0', 1, '1474884969', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(134, 106, NULL, NULL, NULL, NULL, ' Computer and Accessories', '/1/89/106/', 4, 'ast', 'dr', 0, '0', '73750', '72000', 1, '1474885108', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(135, 106, NULL, NULL, NULL, NULL, 'Office Equipments', '/1/89/106/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885080', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(136, 106, NULL, NULL, NULL, NULL, 'Furnitures & Fixtures', '/1/89/106/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885135', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(137, 106, NULL, NULL, NULL, NULL, 'Office Vehicles', '/1/89/106/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885189', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(138, 107, NULL, NULL, NULL, NULL, 'Computer Software', '/1/89/107/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885232', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(139, 108, NULL, NULL, NULL, NULL, 'Fixed Deposit Receipts (FDR)', '/1/89/108/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885286', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(140, 139, NULL, NULL, NULL, NULL, 'FDR With Bank', '/1/89/108/139/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885383', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(141, 139, NULL, NULL, NULL, NULL, 'FDR With Leasing', '/1/89/108/139/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885435', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(142, 108, NULL, NULL, NULL, NULL, ' Investment In Share', '/1/89/108/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885502', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(144, 108, NULL, NULL, NULL, NULL, ' Investment In Inter Company', '/1/89/108/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885550', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(148, 109, NULL, NULL, NULL, NULL, 'Stock of Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '9000', '518584.00347826', '518584.00347826', 1, '1474885933', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(149, 109, NULL, NULL, NULL, NULL, 'Stock of Customer Return Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '450', '450', 1, '1474885969', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(150, 109, NULL, NULL, NULL, NULL, 'Stock of Repirable Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474885988', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(151, 109, NULL, NULL, NULL, NULL, ' Stock at Vendors', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '1800', '1800', 1, '1474885966', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(152, 109, NULL, NULL, NULL, NULL, 'Stock of Damage Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474886046', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(153, 109, NULL, NULL, NULL, NULL, ' Stock of Repired Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474886077', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(154, 109, NULL, NULL, NULL, NULL, 'Stock of Warranty & Support Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474886072', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(155, 109, NULL, NULL, NULL, NULL, ' Stock of Customer Goods', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474886154', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(170, 110, NULL, NULL, NULL, NULL, 'Receivable From Corporate', '/1/90/110/', 4, 'ast', 'dr', 0, '0', '7825182.48', '8389738.48', 1, '1474952183', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(173, 90, NULL, NULL, NULL, NULL, 'Interest Receivable', '/1/90/', 3, 'ast', 'dr', 0, '0', '0', '0', 1, '1474953107', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(176, 112, NULL, NULL, NULL, NULL, 'Advances', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '463837.25', '-376892.75', 1, '1474953394', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(177, 112, NULL, NULL, NULL, NULL, 'Deposits', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474953445', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(178, 112, NULL, NULL, NULL, NULL, 'Prepayments', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474953491', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(179, 176, NULL, NULL, NULL, NULL, 'Advance Against Expenses', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474960927', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(180, 176, NULL, NULL, NULL, NULL, ' Advance for L/C', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474960968', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(181, 176, NULL, NULL, NULL, NULL, ' Advance to Supplier', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '408980', '-431750', 1, '1474960978', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(182, 176, NULL, NULL, NULL, NULL, 'Advances To Directors', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474961047', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(183, 177, NULL, NULL, NULL, NULL, 'Tender Security By Pay Order', '/1/90/112/177/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474961113', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(184, 177, NULL, NULL, NULL, NULL, 'Tender Security By Bank Guarantee', '/1/90/112/177/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474961091', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(185, 177, NULL, NULL, NULL, NULL, ' Performance Guarantee', '/1/90/112/177/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1474961164', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(204, 114, NULL, NULL, NULL, NULL, 'Cash in Hand', '/1/90/114/', 4, 'ast', 'dr', 0, '0', '2253486.15', '-731448.35', 1, '1474962963', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(205, 114, NULL, NULL, NULL, NULL, 'Cash at Bank', '/1/90/114/', 4, 'ast', 'dr', 0, '0', '-4556051.69', '-75997.01', 1, '1474962998', NULL, NULL, NULL, NULL, NULL, '_BP_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(214, 114, NULL, NULL, NULL, NULL, 'Project Bank A/C', '/1/90/114/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1474963658', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(218, 129, NULL, NULL, NULL, NULL, 'Office Rent', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '1340000', '200000', 1, '1474972068', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(219, 129, NULL, NULL, NULL, NULL, 'Conveyance Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '14697.13', '14697.13', 1, '1474972085', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(220, 129, NULL, NULL, NULL, NULL, 'Office Maintenance', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '11074', '11074', 1, '1474972142', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(221, 129, NULL, NULL, NULL, NULL, 'Entertainment', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '1050', '1050', 1, '1474972204', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(222, 130, NULL, NULL, NULL, NULL, 'Tour & Travell-Local (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '5250', '5250', 1, '1474972290', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(223, 130, NULL, NULL, NULL, NULL, 'Entertainment Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '12540', '12540', 1, '1474972284', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(224, 130, NULL, NULL, NULL, NULL, 'Office Maintenance Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '2995', '2995', 1, '1474972311', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(225, 130, NULL, NULL, NULL, NULL, 'Vehicle Fuel & Oil Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1474972366', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(226, 130, NULL, NULL, NULL, NULL, 'Vehicle Repair & Maintenance Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1474972488', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(234, 123, NULL, NULL, NULL, NULL, 'Credit Sales', '/4/101/123/', 4, 'inc', 'cr', 0, '0', '5784511.53', '5784511.53', 1, '1474973021', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(235, 123, NULL, NULL, NULL, NULL, 'Cash Sales', '/4/101/123/', 4, 'inc', 'cr', 0, '0', '10626937.073', '10626937.073', 1, '1474973040', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(236, 234, NULL, NULL, NULL, NULL, 'Project Sales', '/4/101/123/234/', 5, 'inc', 'cr', 0, '0', '2219253.86', '2219253.86', 1, '1474973224', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(237, 236, NULL, NULL, NULL, NULL, ' Packages Sales', '/4/101/123/234/236/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474973231', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(238, 236, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/234/236/', 6, 'inc', 'cr', 0, '0', '546428.86', '546428.86', 1, '1474973281', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(239, 236, NULL, NULL, NULL, NULL, ' Subscription Fee', '/4/101/123/234/236/', 6, 'inc', 'cr', 0, '0', '1672825', '1672825', 1, '1474973361', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(240, 236, NULL, NULL, NULL, NULL, 'Grant Income', '/4/101/123/234/236/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474973356', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(241, 234, NULL, NULL, NULL, NULL, ' Corporate Sales', '/4/101/123/234/', 5, 'inc', 'cr', 0, '0', '1047138.63', '1047138.63', 1, '1474973425', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(242, 234, NULL, NULL, NULL, NULL, 'Tender Sales', '/4/101/123/234/', 5, 'inc', 'cr', 0, '0', '0', '0', 1, '1474973480', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(243, 234, NULL, NULL, NULL, NULL, ' Retails Sales', '/4/101/123/234/', 5, 'inc', 'cr', 0, '0', '2518119.04', '2518119.04', 1, '1474973532', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(244, 123, NULL, NULL, NULL, NULL, 'Inter-company Sales', '/4/101/123/', 4, 'inc', 'cr', 0, '0', '0', '0', 1, '1474973626', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(245, 235, NULL, NULL, NULL, NULL, 'Corporate Sales', '/4/101/123/235/', 5, 'inc', 'cr', 0, '0', '5143484.85', '5143484.85', 1, '1474973755', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(246, 235, NULL, NULL, NULL, NULL, 'Retails Sales', '/4/101/123/235/', 5, 'inc', 'cr', 0, '0', '5483452.223', '5483452.223', 1, '1474973789', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(247, 245, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/235/245/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974013', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(248, 241, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/234/241/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974078', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(249, 245, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/235/245/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974051', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(250, 241, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/234/241/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974091', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(251, 245, NULL, NULL, NULL, NULL, 'Servicing Fee', '/4/101/123/235/245/', 6, 'inc', 'cr', 0, '0', '5143484.85', '5143484.85', 1, '1474974159', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(252, 241, NULL, NULL, NULL, NULL, 'Subscription Fee', '/4/101/123/234/241/', 6, 'inc', 'cr', 0, '0', '1047138.63', '1047138.63', 1, '1474974167', NULL, NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(253, 246, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/235/246/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974209', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(254, 243, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/234/243/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974276', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(255, 246, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/235/246/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974319', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(256, 243, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/234/243/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974330', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(257, 246, NULL, NULL, NULL, NULL, 'Servicing Fee', '/4/101/123/235/246/', 6, 'inc', 'cr', 0, '0', '5483452.223', '5483452.223', 1, '1474974374', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(258, 243, NULL, NULL, NULL, NULL, 'Servicing Fee', '/4/101/123/234/243/', 6, 'inc', 'cr', 0, '0', '2518119.04', '2518119.04', 1, '1474974384', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(259, 242, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/234/242/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974473', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(260, 242, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/234/242/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974414', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(261, 242, NULL, NULL, NULL, NULL, 'Servicing Fee', '/4/101/123/234/242/', 6, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974435', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(262, 244, NULL, NULL, NULL, NULL, 'Package Sales', '/4/101/123/244/', 5, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974547', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(263, 244, NULL, NULL, NULL, NULL, 'Product Sales', '/4/101/123/244/', 5, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974576', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(264, 244, NULL, NULL, NULL, NULL, 'Servicing Fee', '/4/101/123/244/', 5, 'inc', 'cr', 0, '0', '0', '0', 1, '1474974532', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(289, 5, 128, 1, NULL, 128, 'Salary Advance', '/5/', 2, 'exp', 'dr', 0, '0', '0', '0', 1, 'ada aa dada', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(308, 117, 0, 0, NULL, NULL, 'Rawmaterial Pending GRN', '/3/95/100/117/', 5, 'lib', 'cr', 0, '0', '2000', '2000', 1, '1483954140', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(309, 176, 0, 0, NULL, NULL, 'VAT Current A/C (MF)', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '54857.25', '54857.25', 1, '1483957165', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(310, 176, 0, 0, NULL, NULL, 'Advance Income Tax (AIT)', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1483957539', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(311, 130, 0, 0, NULL, NULL, 'VAT Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1483957576', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(312, 337, 0, 0, NULL, NULL, 'Supplier TDS Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1485159266', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(313, 337, 0, 0, NULL, NULL, 'Supplier VDS Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1485161220', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(314, 132, 0, 0, NULL, NULL, 'Interest Expense', '/5/105/132/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1486324461', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(337, 100, 0, 0, NULL, NULL, 'Provisions For Expense', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '-88026.51', '6948015.49', 1, '1489316998', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(339, 117, 0, 0, NULL, NULL, 'Fixed Asset Pending GRN', '/3/95/100/117/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '12544545', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(340, 337, 0, 0, NULL, NULL, 'Salary Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '590659', '7320897', 1, '145445454', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(341, 337, 0, 0, NULL, NULL, 'TA/DA Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1255444', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(342, 337, 0, 0, NULL, NULL, 'Subsidies Fooding Bill Payble', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '-3500', '-3500', 1, '011455', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(343, 337, 0, 0, NULL, NULL, 'Employee TDS Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '45454575', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(344, 337, 0, 0, NULL, NULL, 'Administrative Expense Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '455222', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(345, 337, 0, 0, NULL, NULL, 'Marketing Expense Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '4545574575', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(346, 337, 0, 0, NULL, NULL, 'Transportation-In Expense Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '17575', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(347, 337, 0, 0, NULL, NULL, 'Loading Unloading Expense Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '5454545', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(414, 109, 0, 0, NULL, NULL, 'Fixed Asset Godown', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '196000', '196000', 1, '1491135287', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(417, 109, 0, 0, NULL, NULL, 'Non store Item Godown', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '868948.33', '868948.33', 1, '1491135425', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(418, 117, 0, 0, NULL, NULL, 'Non Store Pending GRN', '/3/95/100/117/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1491135629', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(679, 109, 0, 0, NULL, NULL, 'Stock In Transit', '/1/90/109/', 4, 'ast', 'dr', 0, '0', '-32740', '-32740', 1, '1495287836', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(680, 5, 0, 0, NULL, NULL, 'Accrued Expenses', '/5/', 2, 'exp', 'dr', 0, '0', '0', '0', 1, '1495288073', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(681, 680, 0, 0, NULL, NULL, 'Sales Tax Payable', '/5/680/', 3, 'exp', 'dr', 0, '0', '0', '0', 1, '1495288099', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(772, 130, NULL, 0, NULL, NULL, 'Sales Commission (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1499765363', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(845, 130, 0, 0, NULL, NULL, 'Conveyance Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '33098', '33098', 1, '1501404005', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(847, 130, 0, 0, NULL, NULL, 'Food Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '35300', '35300', 1, '1501404068', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(849, 130, 0, 0, NULL, NULL, 'Labour Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '1300', '1300', 1, '1501404317', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(851, 130, 0, 0, NULL, NULL, 'Postage & Courier Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '2500', '2500', 1, '1501405173', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(856, 129, 0, 0, NULL, NULL, 'Food Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '-1751', '-1751', 1, '1501408664', NULL, NULL, NULL, NULL, NULL, '_FEG_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(892, 100, 0, 0, NULL, NULL, 'Liability for Expenses', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1502178186', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(893, 892, 0, 0, NULL, NULL, 'Group Common Service Payable', '/3/95/100/892/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1502178440', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(895, 129, 0, 0, NULL, NULL, 'Salary & Wages ', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '7748057', '7748057', 1, '1502272810', NULL, NULL, NULL, NULL, NULL, '_WPH_', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(905, 129, 0, 0, NULL, NULL, 'Mobile Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '18619', '18619', 1, '1502599240', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(906, 130, 0, 0, NULL, NULL, 'Mobile Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '4912', '4912', 1, '1502599306', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(907, 100, 0, 0, NULL, NULL, 'Liabilities for Service Provider', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '-24396', '257342', 1, '1502601087', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(911, 130, 0, 0, NULL, NULL, 'Consultant Salary (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1502604435', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(912, 129, 0, 0, NULL, NULL, 'PF-Contribution Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1502607756', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(913, 130, 0, 0, NULL, NULL, 'Contribution Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1502607855', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(915, 337, 0, 0, NULL, NULL, 'PF-Contribution Payable (Company)', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1502607953', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(916, 337, 0, 0, NULL, NULL, 'PF-Employee Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1502608009', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(917, 130, 0, 0, NULL, NULL, 'PF-Contribution Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1502608053', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(918, 129, 0, 0, NULL, NULL, 'Canteen Subsidies Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '42000', '42000', 1, '1502689276', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(921, 129, 0, 0, NULL, NULL, 'Registration & Renewal Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1502954287', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(928, 129, 0, 0, NULL, NULL, 'Drinking Water Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '400', '400', 1, '1503122230', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(931, 130, 0, 0, NULL, NULL, 'TA/DA Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1503215565', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(934, 129, 0, 0, NULL, NULL, 'Festival Bonus.', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '3500', '0', 1, '1503298990', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(956, 112, 0, 0, NULL, NULL, 'Loan', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '-110391.62', '-150391.62', 1, '1503396565', NULL, NULL, NULL, NULL, NULL, '_GEMP_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(993, 112, 0, 0, NULL, NULL, 'Advance Salary', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1505190219', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(994, 130, 0, 0, NULL, NULL, 'Tender Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '11150', '11150', 1, '1505630436', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(996, 129, 0, 0, NULL, NULL, 'Internet Expenses ', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '81000', '72000', 1, '1505635549', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1013, 130, 0, 0, NULL, NULL, 'Transport Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '246517', '246517', 1, '1506408181', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1014, 130, 0, 0, NULL, NULL, 'Registration & Renewal Fees (S&D) ', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1507102173', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1069, 100, 0, 0, NULL, NULL, 'Pending Expense For Inventory', '/3/95/100/', 4, 'lib', 'cr', 0, '0', '0', '0', 1, '1507550703', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1087, 129, 0, 0, NULL, NULL, 'VAT Expenses (AMD)', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1508321476', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1088, 129, 0, 0, NULL, NULL, 'Consultant Fees (AMD)', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '88722', '57722', 1, '1508322053', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1089, 129, 0, 0, NULL, NULL, 'Printing & Stationary Expenses (AMD)', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '57271', '57271', 1, '1508834858', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1110, 110, 0, 0, NULL, NULL, 'Receivable From Individual', '/1/90/110/', 4, 'ast', 'dr', 0, '0', '107768.865', '77498.865', 1, '1510125610', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1122, 129, 0, 0, NULL, NULL, 'Vehicle Repair & Maintenance ', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1511073959', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1131, 110, 0, 0, NULL, NULL, 'Receivable From Tender', '/1/90/110/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1511542271', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1132, 112, 0, 0, NULL, NULL, 'Advance for Inventorial Cost', '/1/90/112/', 4, 'ast', 'dr', 0, '0', '0', '0', 1, '1511763758', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1133, 180, 0, 0, NULL, NULL, 'T.T. Expenses', '/1/90/112/176/180/', 6, 'ast', 'dr', 0, '0', '0', '0', 1, '1511763968', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1136, 132, 0, 0, NULL, NULL, 'Bank Guarantee Expenses', '/5/105/132/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1512294061', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1138, 129, 0, 0, NULL, NULL, 'Lab Test (ADM)', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1512541050', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1139, 129, 0, 0, NULL, NULL, 'Vehicle Penalty', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1512541535', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1145, 130, 0, 0, NULL, NULL, 'Business Promotion Expenses (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '9805', '9805', 1, '1513148571', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1163, 130, 0, 0, NULL, NULL, 'Claim without Receipt (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1514098764', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1164, 337, 0, 0, NULL, NULL, 'Employee Expenses Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1514349089', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1173, 176, 0, 0, NULL, NULL, 'Advance to Service Provider', '/1/90/112/176/', 5, 'ast', 'dr', 0, '0', '0', '0', 1, '1514874298', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1249, 112, 0, 0, NULL, NULL, 'Margin on LC / T.T', '/1/90/112/', 4, 'ast', 'dr', 1, '0', '0', '0', 1, '1516097390', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1260, 130, 0, 0, NULL, NULL, 'Servicing Expense (S&D)', '/5/104/130/', 4, 'exp', 'dr', 0, '0', '1300', '1300', 1, '1516776147', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1263, 121, 0, 0, NULL, NULL, 'Inter-company Supplier', '/3/95/100/121/', 5, 'lib', 'cr', 0, '0', '0', '0', 1, '1517204757', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1268, 132, 0, 0, NULL, NULL, 'Bank Charge & Others', '/5/105/132/', 4, 'exp', 'dr', 0, '0', '5997.01', '5997.01', 1, '1517382637', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1286, 129, 0, 0, NULL, NULL, 'Circular & Notice Expense', '/5/104/129/', 4, 'exp', 'dr', 1, '0', '4095', '4095', 1, '1581181251', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1287, 337, 0, 0, NULL, NULL, 'Provision for Expert Fee - Khandoker Mozibul Yasser', '/3/95/100/337/', 5, 'ast', 'cr', 0, '0', '-617900', '-417900', 1, '1604220268', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1300, 129, 0, 1, NULL, NULL, 'Office Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '-39526.01', '-64526.01', 1, '1652095445', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1303, 129, 0, 1, NULL, NULL, 'Utility Bill Expense', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '208334.5', '20374.5', 1, '1654154843', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1304, 129, 0, 1, NULL, NULL, 'Office Rent Service Charge Expense', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '183000', '21000', 1, '1654154865', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1305, 129, 0, 1, NULL, NULL, 'Housekeeper Expense', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '4050', '-4050', 1, '1654154934', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1310, 104, 0, 0, NULL, NULL, 'Branding and Advertisement Expenses', '/5/104/', 3, 'exp', 'dr', 0, '0', '29880', '29880', 1, '1670326353', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1317, 129, 0, 1, NULL, NULL, 'Travel Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '48266.85', '48266.85', 1, '1673956150', NULL, NULL, NULL, NULL, NULL, '_TREG_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1318, 129, 0, 1, NULL, NULL, 'Transport Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '42932.62', '42932.62', 1, '1673956195', NULL, NULL, NULL, NULL, NULL, '_TEG_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1319, 129, 0, 1, NULL, NULL, 'Medical Expenses', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '22801.49', '22801.49', 1, '1673956207', NULL, NULL, NULL, NULL, NULL, '_MEG_', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1321, 129, 0, 1, NULL, NULL, 'Hosting Cost of Raach Solar', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '119552', '119552', 1, '1684990909', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1328, 1310, 0, 1, NULL, NULL, 'Fair Booking and Other Charges', '/5/104/1310/', 4, 'exp', 'dr', 0, '0', '29880', '29880', 1, '1699183420', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1329, 129, 0, 1, NULL, NULL, 'House Rent', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1704705446', NULL, NULL, NULL, NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(1352, 337, 0, 0, NULL, NULL, 'Provisions For Medical Expenses', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '22801.49', '22801.49', 1, '1716620751', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1354, 129, 0, 1, NULL, NULL, 'Design and Development', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '73420', '73420', 1, '1716627877', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1355, 129, 0, 1, NULL, NULL, 'Expert Fees', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '30000', '30000', 1, '1716635104', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1370, 5, 0, 1, NULL, NULL, 'Advertisement', '/5/', 2, 'exp', 'dr', 0, '0', '3860', '3860', 1, '1717912947', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1378, 5, 0, 1, NULL, NULL, 'Miscellaneous Expenses', '/5/', 2, 'exp', 'dr', 0, '0', '11170', '11170', 1, '1718870543', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1383, 5, 0, 1, NULL, NULL, 'Kitchen Items', '/5/', 2, 'exp', 'dr', 0, '0', '27244', '27244', 1, '1719491722', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1387, 129, 0, 1, NULL, NULL, 'Office Decoration and Interior', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1724329508', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1399, 131, 0, 1, NULL, NULL, 'Seminar Expenses', '/5/104/131/', 4, 'exp', 'dr', 0, '0', '26490', '26490', 1, '1728195213', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1436, 129, 0, 1, NULL, NULL, 'Online Services Fee', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '3988', '3988', 1, '1731823696', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1440, 129, 0, 1, NULL, NULL, 'Device Expense', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '1500', '0', 1, '1732787677', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1441, 129, 0, 1, NULL, NULL, 'Overtime Wages', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '11712', '11712', 1, '1732805507', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1442, 337, 0, 0, NULL, NULL, 'Overtime Wages Payable ', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '0', '11712', 1, '1732805579', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1461, 337, 0, 0, NULL, NULL, 'Festival Bonus Payable', '/3/95/100/337/', 5, 'lib', 'cr', 0, '0', '-80087', '2000', 1, '1734418459', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1465, 129, 0, 1, NULL, NULL, 'B-Kash Charge', '/5/104/129/', 4, 'exp', 'dr', 0, '0', '0', '0', 1, '1734595091', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(1478, 121, 0, 1, NULL, NULL, 'Local Supplier', '/3/95/100/121/', 5, 'lib', 'cr', 0, '0', '-81010', '302000', NULL, '1737279954', NULL, NULL, NULL, NULL, NULL, '', '', '', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `acc_prefix` (`prefix_id`, `name`, `type`, `company_id`, `details`, `doc_booked_flag`, `time_stamp_of_form`, `created_login_id`, `edited_login_id`, `created_user_id`, `edited_user_id`, `created_sig_id`, `edited_sig_id`) VALUES
(1, 'GN', 'jv', NULL, '[{\"head_id\":\"\",\"cost_centre\":\"\",\"type\":\"dr\"}]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'GN', 'pv', NULL, '[{\"head_id\":\"\",\"cost_centre\":\"\",\"type\":\"dr\"}]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, 'GN', 'rv', NULL, '[{\"head_id\":\"\",\"cost_centre\":\"\",\"type\":\"dr\"}]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(4, 'GN', 'cv', NULL, '[{\"head_id\":\"\",\"cost_centre\":\"\",\"type\":\"dr\"}]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `acc_setting` (`id`, `name`, `data`, `company_id`, `create_login_id`, `edit_login_id`, `lock_flag`, `created_at`, `updated_at`, `doc_booked_flag`, `time_stamp_of_form`) VALUES
(1, 'contra_voucher_credit_parents', '[\"114\"]', NULL, NULL, 12, NULL, '2025-01-19 15:51:34', '2025-02-20 18:08:16', NULL, NULL),
(2, 'accounting_year_start', 'January 19, 2025', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(3, 'ledger_balance_display_method', '0', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(4, 'profit_loss_parent', '98', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(5, 'cash_parents', '[\"204\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(6, 'branch_cash_parent', '204', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(7, 'branch_bank_parent', '205', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(8, 'acc_dep_head_fa', '122', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(9, 'bank_parents', '[\"205\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(10, 'purchase_vat_head', '309', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(11, 'purchase_ait_head', '681', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(12, 'purchase_tds_head', '312', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(13, 'purchase_vds_head', '313', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(14, 'sales_tax_head', '681', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(15, 'sales_vat_head', '309', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(16, 'sales_ait_head', '310', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(17, 'lc_ac_parent', '1249', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(18, 'expense_parent', '5', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(19, 'free_item_expense_head', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(20, 'transport_onsite_head', '346', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(21, 'lul_onsite_head', '347', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(22, 'supplier_parent_1_1', '1478', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(23, 'supplier_parent_1_2', '1478', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(24, 'supplier_parent_2_1', '1478', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(25, 'supplier_parent_2_2', '1478', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(26, 'cogs', '126', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(27, 'credit_note_price_type', '1', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(28, 'sales_replacement_cost_head', '126', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(29, 'project_receivable_parent', '1', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(30, 'internal_project_capital_parent', '1', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(31, 'sales_project_capital_parent', '1', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(32, 'project_receivable_parent_advance', '1', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(33, 'revenue_parent_99_99_99', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(34, 'product_name_display_method', '0', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(35, 'inventory_parent', '109', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(36, 'seperate_inventory_by_item_group', '0', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(37, 'fa_head', '414', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(38, 'non_store_head', '417', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(39, 'inv_on_transit_head', '679', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(40, 'pending_inventory_expense_head', '1069', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(41, 'pending_grn_head', '308', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(42, 'pending_grn_head_fa', '339', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(43, 'warehouse_action_1', '148', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(44, 'warehouse_action_2', '149', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(45, 'warehouse_action_3', '150', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(46, 'warehouse_action_4', '151', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(47, 'warehouse_action_5', '152', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(48, 'warehouse_action_6', '153', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(49, 'warehouse_action_7', '154', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(50, 'warehouse_action_8', '155', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(51, 'warehouse_action_9', '414', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(52, 'warehouse_action_10', '417', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(53, 'warehouse_action_11', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(54, 'warehouse_action_12', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(55, 'warehouse_action_13', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(56, 'warehouse_action_14', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(57, 'warehouse_action_15', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(58, 'warehouse_action_16', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(59, 'warehouse_action_17', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(60, 'warehouse_action_18', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(61, 'warehouse_action_19', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(62, 'warehouse_action_20', '', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(63, 'contra_voucher_debit_parents', '[\"114\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(64, 'payment_voucher_credit_parents', '[\"114\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(65, 'receipt_voucher_credit_parents', '[\"3\",\"4\",\"90\",\"94\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(66, 'receipt_voucher_debit_parents', '[\"114\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(67, 'expense_party_parents', '[\"121\"]', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(68, 'timeStampOfForm', '1740053249', NULL, 3, 12, NULL, '2025-01-19 15:53:18', '2025-02-20 18:08:16', NULL, NULL),
(69, 'client_parent_1_1', '1110', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(70, 'client_parent_1_2', '118', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(71, 'client_parent_2_1', '170', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(72, 'client_parent_2_2', '118', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(73, 'revenue_parent_1_1_1', '253', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(74, 'revenue_parent_1_1_2', '253', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(75, 'revenue_parent_1_2_1', '238', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(76, 'revenue_parent_1_2_2', '238', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(77, 'revenue_parent_1_3_1', '255', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(78, 'revenue_parent_1_3_2', '256', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(79, 'revenue_parent_2_1_1', '247', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(80, 'revenue_parent_2_1_2', '248', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(81, 'revenue_parent_2_2_1', '249', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(82, 'revenue_parent_2_2_2', '238', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(83, 'revenue_parent_2_3_1', '249', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(84, 'revenue_parent_2_3_2', '250', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(85, 'revenue_parent_1_1_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(86, 'revenue_parent_1_1_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(87, 'revenue_parent_1_2_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(88, 'revenue_parent_1_2_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(89, 'revenue_parent_1_3_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(90, 'revenue_parent_1_3_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(91, 'revenue_parent_2_1_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(92, 'revenue_parent_2_1_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(93, 'revenue_parent_2_2_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(94, 'revenue_parent_2_2_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(95, 'revenue_parent_2_3_1_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL),
(96, 'revenue_parent_2_3_2_2', '', NULL, 3, 12, NULL, '2025-01-19 16:13:47', '2025-02-20 18:08:16', NULL, NULL);
INSERT INTO `client_type` (`client_type_id`, `name`, `company_id`, `default_revenue_flag`, `secondary_sales_enabled_flag`, `no_branching`, `warranty_grace_mon`, `doc_booked_flag`, `time_stamp_of_form`, `created_login_id`, `edited_login_id`, `created_user_id`, `edited_user_id`, `created_sig_id`, `edited_sig_id`) VALUES
(1, 'Retail', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'Corporate', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `currencies` (`currency_id`, `code`, `name`, `symbol`, `global_id`, `sync_flag`, `multiplier`, `cent_text`, `is_default_currency`, `locale`) VALUES
(1, 'BDT', 'Taka', '৳', NULL, NULL, '1', 'paisa', 1, NULL),
(2, 'USD', 'Dollars', '$', NULL, NULL, '117.09', 'cent', NULL, NULL),
(3, 'EUR', 'Euro', '€', NULL, NULL, '127.14', 'cent', NULL, NULL),
(4, 'GBP', 'Pounds', '£', NULL, NULL, '148.02', 'cent', NULL, NULL),
(5, 'CNY', 'RMB/YUAN', 'CNY', NULL, NULL, '17.65', 'cent', NULL, NULL);
INSERT INTO `planning_item` (`id`, `item_alias`, `item_desc`, `data`, `reference_type`, `entry_type`, `project_id`, `production_schedule_id`, `production_id`, `estimated_start_time_ts`, `actual_start_time_ts`, `estimated_completion_time_ts`, `actual_completion_time_ts`, `urgency`, `dependency_planning_ids`, `dependency_planning_data`, `company_id`, `status`, `stage`, `edit_flag`, `delete_flag`, `lock_flag`, `refresh_flag`, `disabled_flag`, `description`, `created_login_id`, `edited_login_id`, `created_at`, `updated_at`, `doc_booked_flag`, `time_stamp_of_form`, `parent_id`, `boq_ref_id`, `production_schedule_entry_item_id`, `target_type`, `target_value`, `break_down_data`, `has_child`, `recurring`, `product_id`, `product_fdm`, `service_id`, `service_fdm`, `head_id`, `completion_percentage`, `tags`, `assigned_to`, `entry_sub_type`, `projected_cost`, `actual_cost`, `files`, `chat_history`, `sequence`, `assigned_to_type`, `assigned_to_ids`, `projected_cost_breakdown`, `actual_cost_breakdown`, `accountable_to_type`, `accountable_to`, `accountable_to_ids`, `consult_to_type`, `consult_to`, `consult_to_ids`, `inform_to_type`, `inform_to`, `inform_to_ids`, `created_user_id`, `edited_user_id`) VALUES
(11, 'General Attendance', NULL, NULL, 1, 0, 0, NULL, NULL, 0, NULL, 0, NULL, 0, NULL, '', 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, '', 378, NULL, '2025-06-02 15:19:41', '2025-06-02 15:19:41', NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1, NULL, '0.000', '0.000', NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `supplier_type` (`supplier_type_id`, `name`, `company_id`, `doc_booked_flag`, `time_stamp_of_form`, `created_login_id`, `edited_login_id`, `created_user_id`, `edited_user_id`, `created_sig_id`, `edited_sig_id`) VALUES
(1, 'Local', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'Foreign', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_department` (`department_id`, `department_name`, `company_id`, `level`, `status`, `last_edit_login_id`, `last_mongolog_id`, `created_at`, `updated_at`, `doc_booked_flag`, `time_stamp_of_form`) VALUES
(1, 'Accounts', NULL, 0, 1, 0, '0', '0000-00-00 00:00:00', NULL, NULL, NULL),
(2, 'Sales', NULL, 0, 1, 0, '0', '0000-00-00 00:00:00', NULL, NULL, NULL),
(3, 'Warehouse', NULL, 0, 1, 0, '0', '0000-00-00 00:00:00', NULL, NULL, NULL),
(4, 'Inventory', NULL, 0, 1, 0, '0', '2016-12-10 00:00:00', NULL, NULL, NULL),
(5, 'Purchase', NULL, 0, 1, NULL, NULL, '2016-12-10 00:00:00', NULL, NULL, NULL),
(6, 'Information Technology', NULL, 0, 1, NULL, NULL, '2017-03-04 00:00:00', NULL, NULL, NULL),
(7, 'Implementation', 1, 0, 1, NULL, NULL, '2017-07-22 00:00:00', NULL, NULL, NULL),
(8, 'Import', NULL, 0, 1, NULL, NULL, '2017-07-29 00:00:00', NULL, NULL, NULL),
(9, 'Administration', NULL, 0, 1, NULL, NULL, '2017-07-29 00:00:00', NULL, NULL, NULL),
(10, 'Project', NULL, 0, 1, NULL, NULL, '2017-07-29 00:00:00', NULL, NULL, NULL),
(11, 'Management', NULL, 0, 1, NULL, NULL, '2017-07-29 00:00:00', NULL, NULL, NULL);
INSERT INTO `sys_module` (`module_id`, `module_name`, `module_route`, `parent_id`, `level`, `status`, `enabled_for_all`, `company_id`, `created_at`, `updated_at`, `doc_booked_flag`, `time_stamp_of_form`) VALUES
(3, 'Purchase Bill Entry', 'create_purchase_invoice', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(4, 'Pending Invoice List', 'pending_invoices', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(5, 'Sales Invoice List', 'sales_invoices', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(6, 'Purchase Invoice List', 'purchase_invoices', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(7, 'Journal Voucher Entry', 'create_journal_voucher', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(8, 'Receipt Voucher Entry', 'create_receipt_voucher', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(9, 'Payment Voucher Entry', 'create_payment_voucher', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(10, 'Contra Voucher Entry', 'create_contra_voucher', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(11, 'Payment/Fund Requisition Entry', 'create_fund_requisition', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(12, 'Vat Deposit Form Entry', 'create_vat_deposit_form', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(14, 'Sales Order Entry', 'create_sales_order', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(15, 'Delivery Order Entry', 'create_delivery_note', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(16, 'Transport Bill Entry', 'create_transport_bill', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(17, 'Sales Bill Entry', 'create_sales_bill', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(18, 'Customer Types', 'client_type', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(22, 'Create New Task', 'create_new_todo', 15, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(23, 'Show Assigned Tasks', 'show_assigned_todo', 15, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(24, 'Assigned Task Details', 'assigned_todo_details', 15, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(27, 'GRN Entry', 'create_received_note', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(28, 'Stock Transfer Entry', 'create_stock_transfer_note', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(29, 'Item Requisition Entry ', 'create_stock_requisition_slip', 7, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(30, 'Stock Return Entry', 'create_stock_return', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(32, 'Purchase Order Entry', 'create_purchase_order', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(35, 'Asset Disposal Order Entry', 'create_fixed_asset_disposal_order', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(37, 'Project Entry', 'create_new_project', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(38, 'Add Project Details', 'add_project_details', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(39, 'Project List', 'project_list', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(40, 'Customer Entry', 'create_client', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(41, 'Supplier Entry', 'create_supplier', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(42, 'Supplier List', 'supplier_list', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(43, 'Customer List', 'client_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(44, 'Customer Profile', 'client_profile', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(45, 'Supplier Profile', 'supplier_profile', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(47, 'Accounts Prefix Settings', 'create_prefix', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(48, 'Transactions list', 'voucher_list', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(49, 'Item Group Settings', 'item_group', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(50, 'Register Product', 'register_product', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(51, 'Ledger Report', 'view_ledger_head', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(52, 'Supplier list', 'supplier_list', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(54, 'view balance sheet', 'view_balance_sheet', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(55, 'view trial balance', 'view_trial_balance', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(56, 'Accounts head Entry', 'create_ledger_head', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(57, 'Accounts head Edit', 'edit_ledger_head', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(58, 'Cost centre Entry', 'add_cost_centre', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(59, 'Accounts Settings', 'acc_settings', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(60, 'Product Entry', 'create_product', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(61, 'Service Entry', 'create_service', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(62, 'Inventory Transactions', 'inventory_transaction_view', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(63, 'Inventory Status', 'inventory_view', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(66, 'Product Details', 'product_view', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(68, 'Material Inward Entry', 'material_inward', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(69, 'Quality Control Entry', 'quality_control', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(70, 'Purchase Order list', 'purchase_orders', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(71, 'Cheque Management', 'check_management', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(72, 'Check Format', 'check_format', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(74, 'My Signature', 'update_signature', 15, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(75, 'GRN (Goods Receipt Note) List', 'grn_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(76, 'Expense Entry', 'create_expense_invoice', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(77, 'Expense Bill List', 'expense_invoices', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(79, 'Store Indent Entry', 'create_store_requisition_slip', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(80, 'Bank Reconciliation', 'bank_recon', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(81, 'Purchase Requisition Entry', 'create_purchase_requisition_slip', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(82, 'Sales Package Entry', 'create_sales_package', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(83, 'sales Order list', 'sales_orders', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(85, 'Delivery Confirmation Entry', 'create_delivery_confirmation', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(86, 'Delivery Order list', 'delivery_orders', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(87, 'Delivery Confirmation List', 'delivery_confirmations', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(88, 'Delivery Receipt Entry', 'create_delivery_receipt', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(89, 'Delivery Receipt List', 'delivery_receipts', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(92, 'Sales Package List', 'product_package_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(93, 'Cheque Register', 'check_register', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(94, 'Fiscal Closing Entry', 'fiscal_closing', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(95, 'Financial Report', 'view_financial_report', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(96, 'View Company Sales Amount', 'view_company_sales_amount', 20, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(97, 'View Company Net Worth', 'view_company_net_worth', 20, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(98, 'View Company Monthly Growth', 'view_company_monthly_growth', 20, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(100, 'stock consumption Report', 'stock_consumption_view', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(101, 'stock requisition list', 'sr_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(102, 'Store Indent list', 'ir_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(103, 'purchase requisition list', 'pr_list', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(104, 'Project Category Settings', 'create_project_category', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(105, 'Supplier Category Settings', 'add_supplier_category', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(106, 'Project Work Stage Settings', 'create_project_work_stage', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(107, 'project BOQ Entry', 'create_project_boq', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(108, 'Project Work Plan Entry', 'create_project_wp', 12, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(109, 'Project Offer Entry', 'create_project_offer', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(110, 'Project BOM Entry', 'create_project_material', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(111, 'Service Receipt Entry', 'create_service_challan', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(112, 'Service Receipt List', 'service_challans', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(113, 'Stock Receive Entry', 'create_stock_received_note', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(114, 'Stock Receive Document List', 'srcv_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(115, 'Stock Transfer Document List', 'st_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(116, 'Product List', 'product_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(118, 'project Proposal entry', 'create_project_proposal', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(119, 'Item Received and Replacement For Sales Entry', 'create_irr', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(120, 'Item Received and replacement List', 'irr_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(121, 'Sales Return Entry', 'create_sales_return', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(122, 'Sales Return List', 'sales_return_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(123, 'Sales Order amendment', 'create_so_amendment', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(124, 'SO Amendment List', 'so_amendment_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(126, 'Proforma Invoice Entry', 'create_proforma_invoice', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(127, 'Insurance Pay Request Entry', 'create_insurance_pay_request', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(128, 'LC Opening request Entry', 'create_lc_opening_request', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(129, 'LC Entry', 'create_lc_entry', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(130, 'Bill of Lading Entry', 'create_bill_of_lading', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(131, 'Bill of Entry', 'create_bill_of_entry', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(132, 'Landed Cost Sheet Entry', 'create_landed_cost_sheet', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(133, 'Proforma Invoice List', 'proforma_invoice_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(134, 'Insurance Pay Request List', 'insurance_pay_request_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(135, 'LC Opening Request List', 'lc_opening_request_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(136, 'LC List', 'lc_entry_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(137, 'Bill of Lading List', 'bill_of_lading_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(138, 'Bill of Entry List', 'bill_of_entry_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(139, 'Landed Cost Sheet List', 'landed_cost_sheet_list', 10, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(140, 'Enforce Edit Project BOQ', 'force_edit_project_boq', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(141, 'Security check', 'security_check', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(142, 'Bank Recon. Statement List', 'brs_list', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(143, 'Stock Consumption Entry', 'create_stock_consumption_note', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(144, 'Stock Consumption Entry list', 'stock_consumption_note_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(145, 'Service Purchase Bill Entry', 'create_service_purchase_invoice', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(146, 'Service Requisition Entry', 'create_service_requisition_slip', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(147, 'Service Requisition List', 'service_requisition_list', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(148, 'Fixed Asset Conversion Entry', 'create_fixed_asset_conversion_note', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(149, 'Fixed Asset Conversion Entry List', 'fixed_asset_conversion_note_list', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(150, 'Fixed Asset List', 'fixed_asset_list', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(151, 'Add Fixed Asset', 'add_fixed_asset', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(152, 'Fixed Asset Category Settings', 'add_fixed_asset_category', 2, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(153, 'Sales Report', 'sales_report', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(154, 'Finance Dashboard', 'finance_dashboard', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(155, 'Financial Budget Entry', 'create_financial_budget', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(156, 'Financial Budget List', 'financial_budget_list', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(157, 'Purchase report', 'purchase_report', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(158, 'sales Region Settings', 'sales_region', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(159, 'Sales Representative Entry', 'sales_person', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(160, 'Branch Settings', 'branch', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(161, 'Brand Settings', 'brand_company', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(162, 'Trade Offer Entry', 'create_trade_offer', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(163, 'Trade Offer List', 'trade_offer_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(164, 'Set Product Price ', 'create_product_mrp_document', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(165, 'Price Settings Document List', 'product_mrp_document_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(166, 'Product Price List', 'product_price_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(168, 'Production Process Settings', 'create_production_process_settings', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(169, 'Production BOM Settings', 'create_production_bom', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(170, 'Production Entry', 'create_production_entry', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(171, 'Sales Dashboard', 'sales_dashboard', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(172, 'Purchase Dashboard', 'purchase_dashboard', 6, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(173, 'Production Dashboard', 'production_dashboard', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(175, 'Distribution Dashboard', 'distribution_dashboard', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(176, 'Inventory Dashboard', 'inventory_dashboard', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(178, 'Service Dashboard', 'service_dashboard', 16, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(179, 'Production View', 'production_view', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(180, 'Customer Ledger', 'view_client_ledger', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(181, 'Order vs Disperse', 'sales_vs_delivery_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(182, 'Project Costing Report', 'view_project_costing_report', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(183, 'Client Pending Order List', 'client_pending_sales_orders', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(184, 'Register Product ', 'register_product', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(185, 'Employee Entry', 'add_employee', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(186, 'Leave Application Entry', 'employee_leave', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(187, 'Leave Application List', 'leave_application_list', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(188, 'Employee List', 'employee_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(189, 'Attendance Report', 'attendance_report', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(190, 'Organization Chart', 'organization_chart', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(191, 'Salary Disbursement', 'disburse_salary', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(192, 'Attendance Entry', 'manual_attendance', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(193, 'Meeting Scheduling', 'meeting_scheduling', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(194, 'Payroll Policy Setting', 'payroll_policy_settings', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(195, 'Resignation Application', 'resign_application', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(196, 'Resignation Application List', 'resign_application_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(197, 'Payslip List', 'payslip_list', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(198, 'Scheduled Meeting List', 'scheduled_meeting_list', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(199, 'Salary Segregation Settings', 'salary_segregation_policy', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(200, 'Workplace Settings', 'set_workplace', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(201, 'Work Hour Settings', 'work_hour_policy', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(202, 'Holiday Calendar Settings', 'create_holiday', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(203, 'Payroll Policy List', 'payroll_policy_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(204, 'Salary Segregation Policy List', 'salary_segregation_policy_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(205, 'Work Hour Policy List', 'work_hour_policy_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(206, 'Human Resource Management Dashboard', 'human_resource_dashboard', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(207, 'Attendance Status', 'current_attendance', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(208, 'Holiday Calendar List', 'holiday_calendar_list', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(209, 'New Recruitment Post', 'create_new_job_post', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(210, 'Recruitment Post List', 'list_job_recruitment', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(211, 'Create Training Schedule', 'create_training_schedule', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(212, 'Employee List By Skill & Performance', 'employee_list_by_skill_performance', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(213, 'Recruitment Post List', 'list_job_recruitment', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(214, 'Employee Expense Allowance Settings', 'create_employee_expense_allowance_settings', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(215, 'Scheduled Interview', 'view_applicant_schedule', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(216, 'Add Skills', 'create_skill', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(217, 'Add Question', 'create_question', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(218, 'Add Education Qualification', 'create_education_qualification', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(219, 'Scheduled Training List', 'scheduled_training_list', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(220, 'Scheduled Interview List', 'scheduled_interview_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(221, 'Training Course', 'create_training_course', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(222, 'Performance Review Dashboard', 'performance_review_dashboard', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(223, 'Recruitment Dashboard', 'recruitment_dashboard', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(224, 'Talent Management Dashboard', 'talent_management_dashboard', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(225, 'Employee Evaluation Categories', 'create_evaluation_category', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(226, 'Harassment Complaint', 'create_workplace_harassment', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(227, 'Workplace Violence Complaint', 'register_workplace_complaint', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(228, 'Employee List', 'employee_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(229, 'Expense Allowance Settings List', 'employee_expense_allowance_settings_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(230, 'Leave Policy Settings List', 'leave_policy_settings_list', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(231, 'Create Leave Policy Settings', 'create_leave_policy_settings', 14, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(232, 'Create Project Site', 'project_site', 12, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(233, 'Serial Product List', 'product_by_code_list', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(234, 'Product Tracking', 'product_tracking', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(235, 'IMEI Check', 'mobile_imei_check', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(236, 'Gift Box Label Print', 'mobile_gb_label_print', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(237, 'IMEI Cross Check', 'mobile_imei_cross_check', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(238, 'Gift Box Weight Check', 'mobile_gb_weight_check', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(239, 'Gift Box Carton Assign', 'mobile_gb_carton_assign', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(240, 'Carton Weight Check', 'mobile_carton_weight_check', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(241, 'Carton Label Print', 'mobile_carton_label_print', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(242, 'IMEI Label Print', 'mobile_device_imei_label_print', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(243, 'Device IMEI List', 'mobile_imei_list', 21, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(244, 'Create Production Schedule', 'create_production_schedule', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(245, 'Consumption Settings', 'consumption_settings', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(246, 'Label Format', 'label_format', 7, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(247, 'Replacement Report', 'replacement_report', 9, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(248, 'Production Schedule List', 'production_schedule_list', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(249, 'Production Entry List', 'production_entry_document_list', 8, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(250, 'Attendance Amendment Entry', 'create_attendance_amendment', 14, 1, 1, 1, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(251, 'Sales Proposal Entry', 'create_sales_proposal', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(252, 'Sales Proposal List', 'sales_proposal_list', 4, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(253, 'Chart of Accounts', 'chart_of_accounts', 1, 1, 1, NULL, NULL, '2025-05-28 09:25:17', NULL, NULL, NULL),
(356, 'File Management', 'file_management_list', 15, 1, 1, NULL, NULL, '2026-05-04 00:00:00', NULL, NULL, NULL);
";
if ($get_kids_sql != "") {
$stmt = $em->getConnection()->executeStatement($get_kids_sql);
}
}
public static function rectifyDatabase($em)
{
}
public static function updatePlanningItemSequence($em, $planningItemId, $assignType = '_ASSIGN_')
{
$primaryOne = $em->getRepository('ApplicationBundle\\Entity\\PlanningItem')
->findOneBy(
array(
'id' => $planningItemId,
)
);
$prevOne = null;
if ($assignType == '_ASSIGN_') {
$seq = 0;
///find a similar one and get its sequence
$prevOneQry = $em->getRepository('ApplicationBundle\\Entity\\PlanningItem')
->createQueryBuilder('m')
->where("m.parentId = :parentId")
->andWhere("m.id != " . $primaryOne->getId())
->andWhere("m.referenceType = " . $primaryOne->getReferenceType())
->setParameter('parentId', $primaryOne->getParentId());
if ($primaryOne->getParentId() == 0) {
if ($primaryOne->getProjectId() != null && $primaryOne->getProjectId() != '')
$prevOneQry->andWhere("m.projectId = " . $primaryOne->getProjectId());
if ($primaryOne->getBoqRefId() != null && $primaryOne->getBoqRefId() != '')
$prevOneQry->andWhere("m.boqRefId = " . $primaryOne->getBoqRefId());
if ($primaryOne->getProductionScheduleId() != null && $primaryOne->getProductionScheduleId() != '')
$prevOneQry->andWhere("m.productionScheduleId = " . $primaryOne->getProductionScheduleId());
if ($primaryOne->getProductionId() != null && $primaryOne->getProductionId() != '')
$prevOneQry->andWhere("m.productionId = " . $primaryOne->getProductionId());
}
$prevOneDataList = $prevOneQry
->orderBy('m.sequence', 'DESC')
->getQuery()
->setMaxResults(1)
->getResult();
if (isset($prevOneDataList[0]))
$prevOne = $prevOneDataList[0];
if ($prevOne)
$seq = $prevOne->getSequence();
if ($seq == null or $seq == '')
$seq = 0;
$primarySeq = $seq + 1;
if ($primaryOne->getSequence() == null || $primaryOne->getSequence() == 0) {
$primaryOne->setSequence($primarySeq);
if ($prevOne) {
$prevOne->setSequence($seq);
}
$em->flush();
}
}
if ($assignType == '_MOVE_DOWN_') {
$seq = 0;
$prevOne = null;
$primarySeq = $primaryOne->getSequence();
///find a similar one and get its sequence
$prevOneQry = $em->getRepository('ApplicationBundle\\Entity\\PlanningItem')
->createQueryBuilder('m')
->where("m.parentId = :parentId")
->andWhere("m.id != " . $primaryOne->getId())
->andWhere("m.referenceType = " . $primaryOne->getReferenceType())
->andWhere("m.sequence > " . $primaryOne->getSequence())
->setParameter('parentId', $primaryOne->getParentId());
// ->andWhere("m.projectId = " .$primaryOne->getProjectId())
// ->andWhere("m.boqRefId = " .$primaryOne->getBoqRefId());
if ($primaryOne->getParentId() == 0) {
if ($primaryOne->getProjectId() != null && $primaryOne->getProjectId() != '')
$prevOneQry->andWhere("m.projectId = " . $primaryOne->getProjectId());
if ($primaryOne->getBoqRefId() != null && $primaryOne->getBoqRefId() != '')
$prevOneQry->andWhere("m.boqRefId = " . $primaryOne->getBoqRefId());
if ($primaryOne->getProductionScheduleId() != null && $primaryOne->getProductionScheduleId() != '')
$prevOneQry->andWhere("m.productionScheduleId = " . $primaryOne->getProductionScheduleId());
if ($primaryOne->getProductionId() != null && $primaryOne->getProductionId() != '')
$prevOneQry->andWhere("m.productionId = " . $primaryOne->getProductionId());
}
$prevOneDataList = $prevOneQry
->orderBy('m.sequence', 'ASC')
->getQuery()
->setMaxResults(1)
->getResult();
if (isset($prevOneDataList[0]))
$prevOne = $prevOneDataList[0];
if ($prevOne)
$seq = $prevOne->getSequence();
if ($seq == null or $seq == '')
$seq = 0;
if ($seq > 0 && $prevOne != null) {
$primaryOne->setSequence($seq);
if ($prevOne) {
$prevOne->setSequence($primarySeq);
}
}
$em->flush();
}
if ($assignType == '_MOVE_UP_') {
$seq = 0;
$prevOne = null;
$primarySeq = $primaryOne->getSequence();
if ($primarySeq > 0) {
///find a similar one and get its sequence
$prevOneQry = $em->getRepository('ApplicationBundle\\Entity\\PlanningItem')
->createQueryBuilder('m')
->where("m.parentId = :parentId")
->andWhere("m.id != " . $primaryOne->getId())
->andWhere("m.referenceType = " . $primaryOne->getReferenceType())
->andWhere("m.sequence < " . $primaryOne->getSequence())
->setParameter('parentId', $primaryOne->getParentId());
// ->andWhere("m.projectId = " .$primaryOne->getProjectId())
// ->andWhere("m.boqRefId = " .$primaryOne->getBoqRefId());
if ($primaryOne->getParentId() == 0) {
if ($primaryOne->getProjectId() != null && $primaryOne->getProjectId() != '')
$prevOneQry->andWhere("m.projectId = " . $primaryOne->getProjectId());
if ($primaryOne->getBoqRefId() != null && $primaryOne->getBoqRefId() != '')
$prevOneQry->andWhere("m.boqRefId = " . $primaryOne->getBoqRefId());
if ($primaryOne->getProductionScheduleId() != null && $primaryOne->getProductionScheduleId() != '')
$prevOneQry->andWhere("m.productionScheduleId = " . $primaryOne->getProductionScheduleId());
if ($primaryOne->getProductionId() != null && $primaryOne->getProductionId() != '')
$prevOneQry->andWhere("m.productionId = " . $primaryOne->getProductionId());
}
$prevOneDataList = $prevOneQry
->orderBy('m.sequence', 'DESC')
->getQuery()
->setMaxResults(1)
->getResult();
if (isset($prevOneDataList[0]))
$prevOne = $prevOneDataList[0];
if ($prevOne)
$seq = $prevOne->getSequence();
if ($seq == null or $seq == '')
$seq = 0;
if ($seq >= 0 && $prevOne != null) {
$primaryOne->setSequence($seq);
if ($prevOne) {
$prevOne->setSequence($primarySeq);
}
}
$em->flush();
}
}
return array(
'primaryOne' => $primaryOne,
'otherOne' => $prevOne,
);
}
public static function getAppDataByCurl()
{
$urlToCall = GeneralConstant::HONEYBEE_API_SERVER . '/appData.json';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $urlToCall,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
),
// CURLOPT_USERAGENT => 'InnoPM',
// CURLOPT_POSTFIELDS => $post_fields
));
// $headers = array(
// "Accept: application/json",
// );
// curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
////for debug only!
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$retData = curl_exec($curl);
$errData = curl_error($curl);
curl_close($curl);
return $retData;
}
public static function setSessionForUser(
$em,
$session,
$sessionData = [],
$config = [],
$userId = 0,
$loginId = 0,
$userType = 1,
$userData = []
) {
if (empty($sessionData)) {
if (empty($config))
$config = array();
if (!isset($config['firstLogin']))
$config['firstLogin'] = 1;
if (!isset($config['rememberMe']))
$config['rememberMe'] = 0;
if (!isset($config['notificationEnabled']))
$config['notificationEnabled'] = 0;
if (!isset($config['notificationServer']))
$config['notificationServer'] = '';
if (!isset($config['applicationSecret']))
$config['applicationSecret'] = '';
if (!isset($config['gocId']))
$config['gocId'] = '';
if (!isset($config['appId']))
$config['appId'] = '';
if (!isset($config['gocDbName']))
$config['gocDbName'] = '';
if (!isset($config['gocDbUser']))
$config['gocDbUser'] = '';
if (!isset($config['gocDbHost']))
$config['gocDbHost'] = '';
if (!isset($config['gocDbPass']))
$config['gocDbPass'] = '';
$sessionData = array(
UserConstants::USER_ID => $userId,
UserConstants::USER_LOGIN_ID => $loginId,
UserConstants::USER_TYPE => $userType,
UserConstants::FIRST_LOGIN_FLAG => $config['firstLogin'],
UserConstants::APPLICATION_SECRET => $config['applicationSecret'],
UserConstants::USER_NOTIFICATION_ENABLED => $config['notificationEnabled'],
UserConstants::USER_NOTIFICATION_SERVER => $config['notificationServer'],
UserConstants::USER_GOC_ID => $config['gocId'],
UserConstants::USER_DB_NAME => $config['gocDbName'],
UserConstants::USER_DB_USER => $config['gocDbUser'],
UserConstants::USER_DB_HOST => $config['gocDbHost'],
UserConstants::USER_DB_PASS => $config['gocDbPass'],
UserConstants::USER_APP_ID => $config['appId'],
UserConstants::USER_EMAIL => $session->get(UserConstants::USER_EMAIL),
UserConstants::USER_IMAGE => $session->get(UserConstants::USER_IMAGE),
UserConstants::USER_OAUTH_IMAGE => $session->get(UserConstants::USER_OAUTH_IMAGE),
UserConstants::USER_DEFAULT_ROUTE => $session->get(UserConstants::USER_DEFAULT_ROUTE),
UserConstants::USER_NAME => $session->get(UserConstants::USER_NAME),
UserConstants::USER_COMPANY_ID => $session->get(UserConstants::USER_COMPANY_ID),
UserConstants::USER_COMPANY_ID_LIST => $session->get(UserConstants::USER_COMPANY_ID_LIST),
UserConstants::USER_COMPANY_NAME_LIST => $session->get(UserConstants::USER_COMPANY_NAME_LIST),
UserConstants::USER_COMPANY_IMAGE_LIST => $session->get(UserConstants::USER_COMPANY_IMAGE_LIST),
UserConstants::USER_CURRENT_POSITION => $session->get(UserConstants::USER_CURRENT_POSITION),
UserConstants::SESSION_SALT => $session->get(UserConstants::SESSION_SALT),
UserConstants::USER_POSITION_LIST => $session->get(UserConstants::USER_POSITION_LIST),
UserConstants::USER_COMPANY_DARK_VIBRANT_LIST => $session->get('userCompanyDarkVibrantList', []),
UserConstants::USER_COMPANY_VIBRANT_LIST => $session->get('userCompanyVibrantList', []),
UserConstants::USER_COMPANY_LIGHT_VIBRANT_LIST => $session->get('userCompanyLightVibrantList', []),
UserConstants::ALL_MODULE_ACCESS_FLAG => $session->get(UserConstants::ALL_MODULE_ACCESS_FLAG),
UserConstants::PRODUCT_NAME_DISPLAY_TYPE => $session->get(UserConstants::PRODUCT_NAME_DISPLAY_TYPE),
//new
'appIdList' => $session->get('appIdList'),
'branchIdList' => $session->get('branchIdList', null),
'branchId' => $session->get('branchId', null),
'companyIdListByAppId' => $session->get('companyIdListByAppId'),
'companyNameListByAppId' => $session->get('companyNameListByAppId'),
'companyImageListByAppId' => $session->get('companyImageListByAppId'),
);
if ($userType == UserConstants::USER_TYPE_GENERAL) {
}
}
foreach ($sessionData as $key => $val) {
$session->set($key, $val);
}
$tokenData = MiscActions::CreateTokenFromSessionData($em, $sessionData);
$sessionData = $tokenData['sessionData'];
$token = $tokenData['token'];
$session->set('token', $token);
return [
'session' => $session,
'sessionData' => $sessionData,
'tokenData' => $tokenData,
'token' => $token,
];
}
public static function changeDoctrineManagerByAppId($em_goc, $gocEnabled, $appId)
{
$gocList = [];
$em_goc->getConnection()->connect();
$gocEnabled = 1; //OVERRIDE
if ($gocEnabled == 1)
$connected = $em_goc->getConnection()->isConnected();
else
$connected = false;
$goc = null;
if ($connected)
$goc = $em_goc
->getRepository("CompanyGroupBundle\\Entity\\CompanyGroup")
->findOneBy(
array(
'active' => 1,
'appId' => $appId
)
);
$gocDataList = [];
$gocDataListByAppId = [];
$dataToConnect = [];
if ($goc)
$dataToConnect = array(
'dbName' => $goc->getDbName(),
'dbUser' => $goc->getDbUser(),
'dbPass' => $goc->getDbPass(),
'dbHost' => $goc->getDbHost()
);
return $dataToConnect;
}
public static function array_utf8_encode($dat)
{
if (is_string($dat))
return utf8_encode($dat);
if (!is_array($dat))
return $dat;
$ret = array();
foreach ($dat as $i => $d)
$ret[$i] = self::array_utf8_encode($d);
return $ret;
}
public static function encryptSignature($str, $hash = 'monada')
{
$iv = '1234567812345678';
$pass = $hash;
// $method = 'aes-256-cbc';
// $new_data = $str;
$str = $str . 'YmLRocksLikeABoss';
$data = openssl_encrypt($str, "AES-128-CBC", $pass, OPENSSL_RAW_DATA, $iv);
// $data=$str;
$decrypted = openssl_decrypt(base64_decode(base64_encode($data)), "AES-128-CBC", $hash, OPENSSL_RAW_DATA, $iv);
if ($data != false)
$encoded = base64_encode($data);
else
$encoded = false;
// $decrypted = openssl_decrypt(base64_decode($base64), "AES-128-CBC", "some password", OPENSSL_RAW_DATA, $iv);
// $data=openssl_encrypt ($string, $method, $pass,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING, $iv);
// return [$decrypted,$iv,$base64,$str,$new_data];
// return [$encoded,$decrypted];
return $encoded;
}
public static function getPendingApprovalListByUserLoginId($em, $login_id, $includeAbsoluteUrl = 0, $absoluteUrlList = [], $tvp = '', $filterApprovalEntityId = '_all_')
{
$user_data = Users::getUserInfoByLoginId($em, $login_id);
//1st get only currently pendings
$pending_approval_list = [];
$override_approval_list = [];
$grouped_approval_list = [
];
$applicableEntities = [];
$total_pending_task_count = 0;
$generalFilter = ($filterApprovalEntityId == '_all_' || $filterApprovalEntityId == '') ? [] : array(
'entity' => $filterApprovalEntityId
);
$dt = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array_merge(
$generalFilter,
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
'required' => [1],
'action' => [3],
'current' => GeneralConstant::CURRENTLY_PENDING_APPROVAL
)
),
array(
'createdAt' => 'DESC'
)
);
$rl_type = GeneralConstant::$approvalRole;
$amount_methods = ApprovalConstant::$Entity_amount_method;
$note_methods = ApprovalConstant::$Entity_note_method;
// $date_methods = ApprovalConstant::$Entity_date_method;
foreach ($dt as $entry) {
if (in_array($user_data['id'], json_decode($entry->getUserIds(), true) ?? [])) {
$approval_data = [];
$approval_data['createdBy'] = '';
$approval_data['createdUserImage'] = '';
$approval_data['documentHash'] = $entry->getDocumentHash();
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $rl_type[$entry->getRoleType()];
$approval_data['roleTypeId'] = $entry->getRoleType();
$approval_data['createdAt'] = 1 * $entry->getCreatedAt()->format('U');
$approval_data['amount'] = '';
$approval_data['note'] = '';
$approval_data['specialType'] = '';
if ($includeAbsoluteUrl == 1 && isset($absoluteUrlList[$entry->getEntity()])) {
// $approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()];
// $approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()].'/'.$entry->getEntityId().'?tvp='.$tvp;
$approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()] . '/' . $entry->getEntityId();
}
// $approval_data['viewPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'];
$approval_data['viewPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'] : '';
$approval_data['printPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] : $approval_data['viewPath'];
$approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
->findOneBy(
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
// 'required' => [1, 2],
GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
),
array(// 'createdAt' => 'DESC'
)
);
if ($doc) {
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null) {
$approval_data['createdBy'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['name'];
$approval_data['createdUserImage'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['image'];
}
if (isset($amount_methods[$entry->getEntity()]))
$approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
if (isset($note_methods[$entry->getEntity()])) {
if ($doc)
$approval_data['note'] = $doc->{$note_methods[$entry->getEntity()]}();
else
$approval_data['note'] = '';
} else if (method_exists($doc, 'getNote'))
$approval_data['note'] = $doc->getNote();
else if (method_exists($doc, 'getDescription'))
$approval_data['note'] = $doc->getDescription();
else if (method_exists($doc, 'getDesc'))
$approval_data['note'] = $doc->getDesc();
else
$approval_data['note'] = '';
$filePath = '';
if (method_exists($doc, 'getFiles')) {
$filePath = $doc->getFiles() ?: '';
}
$fileEntityName = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_name'] : '';
$approval_data['attachment'] = '';
if ($filePath) {
$approval_data['attachment'] = strpos($filePath, '/') !== false ? $filePath : "uploads/$fileEntityName/" . $filePath;
}
}
$approval_data['entity'] = $entry->getEntity();
$approval_data['entityId'] = $entry->getEntityId();
$approval_data['entityIdPadded'] = str_pad($entry->getEntityId(), 8, '0', STR_PAD_LEFT);
$approval_data['required'] = $entry->getRequired();
$pending_approval_list[] = $approval_data;
if (!isset($grouped_approval_list[$entry->getEntity()])) {
$applicableEntities[] = $entry->getEntity();
$grouped_approval_list[$entry->getEntity()] = array();
}
$grouped_approval_list[$entry->getEntity()][] = $approval_data;
$total_pending_task_count++;
// $approval_data['acted']=1;
}
}
//now optionals
$dt = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array_merge(
$generalFilter,
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
'required' => [0],
'action' => [3],
'current' => GeneralConstant::CURRENTLY_PENDING_APPROVAL
)
),
array(
'createdAt' => 'DESC'
)
);
foreach ($dt as $entry) {
$entry_user_ids = json_decode($entry->getUserIds(), true);
$entry_user_ids = is_array($entry_user_ids) ? $entry_user_ids : [];
if (in_array($user_data['id'], $entry_user_ids)) {
$approval_data = [];
$approval_data['documentHash'] = $entry->getDocumentHash();
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $rl_type[$entry->getRoleType()];
$approval_data['roleTypeId'] = $entry->getRoleType();
$approval_data['createdAt'] = 1 * $entry->getCreatedAt()->format('U');
if ($includeAbsoluteUrl == 1) {
$approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()] . '/' . $entry->getEntityId();
}
$approval_data['viewPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'];
$approval_data['printPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] : GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'];
$approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
$approval_data['entityId'] = $entry->getEntityId();
$approval_data['entityIdPadded'] = str_pad($entry->getEntityId(), 8, '0', STR_PAD_LEFT);
$approval_data['createdBy'] = '';
$approval_data['createdUserImage'] = '';
$approval_data['amount'] = '';
$approval_data['note'] = '';
$approval_data['specialType'] = '';
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
->findOneBy(
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
// 'required' => [1, 2],
GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
),
array(// 'createdAt' => 'DESC'
)
);
if ($doc) {
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null) {
$approval_data['createdBy'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['name'];
$approval_data['createdUserImage'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['image'];
}
if (isset($amount_methods[$entry->getEntity()]))
$approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
if (isset($note_methods[$entry->getEntity()])) {
if ($doc)
$approval_data['note'] = $doc->{$note_methods[$entry->getEntity()]}();
else
$approval_data['note'] = '';
} else if (method_exists($doc, 'getNote'))
$approval_data['note'] = $doc->getNote();
else if (method_exists($doc, 'getDescription'))
$approval_data['note'] = $doc->getDescription();
else if (method_exists($doc, 'getDesc'))
$approval_data['note'] = $doc->getDesc();
else
$approval_data['note'] = '';
}
// $approval_data['amount'] = isset($amount_methods[$entry->getEntity()])?$entry->{$amount_methods[$entry->getEntity()]}():'';
$approval_data['entity'] = $entry->getEntity();
$approval_data['required'] = $entry->getRequired();
$pending_approval_list[] = $approval_data;
if (!isset($grouped_approval_list[$entry->getEntity()])) {
$applicableEntities[] = $entry->getEntity();
$grouped_approval_list[$entry->getEntity()] = array();
}
$grouped_approval_list[$entry->getEntity()][] = $approval_data;
$total_pending_task_count++;
// $approval_data['acted']=1;
}
}
//now override
$dt = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array_merge(
$generalFilter,
array(
'required' => 2,
'action' => 3
)
)
);
foreach ($dt as $entry) {
if (in_array($user_data['id'], json_decode($entry->getUserIds(), true) ?? [])) {
$approval_data = [];
$approval_data['documentHash'] = $entry->getDocumentHash();
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $rl_type[$entry->getRoleType()];
$approval_data['roleTypeId'] = $entry->getRoleType();
$approval_data['required'] = $entry->getRequired();
$approval_data['createdAt'] = 1 * $entry->getCreatedAt()->format('U');
if ($includeAbsoluteUrl == 1) {
$approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()];
}
$approval_data['viewPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'];
$approval_data['printPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] : GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'];
$approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
$approval_data['entityId'] = $entry->getEntityId();
$approval_data['entity'] = $entry->getEntity();
$approval_data['createdBy'] = '';
$approval_data['createdUserImage'] = '';
$approval_data['amount'] = '';
$approval_data['note'] = '';
$approval_data['specialType'] = '';
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
->findOneBy(
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
// 'required' => [1, 2],
GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
),
array(// 'createdAt' => 'DESC'
)
);
if ($doc) {
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null) {
$approval_data['createdBy'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['name'];
$approval_data['createdUserImage'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['image'];
}
if (isset($amount_methods[$entry->getEntity()]))
$approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
if (isset($note_methods[$entry->getEntity()])) {
if ($doc)
$approval_data['note'] = $doc->{$note_methods[$entry->getEntity()]}();
else
$approval_data['note'] = '';
} else if (method_exists($doc, 'getNote'))
$approval_data['note'] = $doc->getNote();
else if (method_exists($doc, 'getDescription'))
$approval_data['note'] = $doc->getDescription();
else if (method_exists($doc, 'getDesc'))
$approval_data['note'] = $doc->getDesc();
else
$approval_data['note'] = '';
}
$override_approval_list[] = $approval_data;
if (!isset($grouped_approval_list[$entry->getEntity()])) {
$applicableEntities[] = $entry->getEntity();
$grouped_approval_list[$entry->getEntity()] = array();
}
$grouped_approval_list[$entry->getEntity()][] = $approval_data;
$total_pending_task_count++;
// $approval_data['acted']=1;
}
}
return array(
"pending_approval_list" => $pending_approval_list,
"override_approval_list" => $override_approval_list,
"applicable_entities" => $applicableEntities,
"grouped_approval_list" => $grouped_approval_list,
"total_pending_task_count" => $total_pending_task_count,
"entity_list_details" => GeneralConstant::$Entity_list_details,
);
}
public static function getPendinDocumentListForAppByUserLoginId(
$em,
$login_id,
$includeAbsoluteUrl = 0,
$absoluteUrlList = [],
$tvp = '',
$filterApprovalEntityId = '_all_',
$page = 1,
$offset = 0,
$limit = 10,
$absoluteUrl = ''
) {
$user_data = Users::getUserInfoByLoginId($em, $login_id);
$pending_approval_list = [];
$grouped_approval_list = [];
$applicableEntities = [];
$total_pending_task_count = 0;
$generalFilter = ($filterApprovalEntityId == '_all_' || $filterApprovalEntityId == '') ? [] : [
'entity' => $filterApprovalEntityId
];
// Define reusable role and amount constants
$rl_type = GeneralConstant::$approvalRole;
$amount_methods = ApprovalConstant::$Entity_amount_method;
$qb = $em->createQueryBuilder()
->select('a')
->from('ApplicationBundle\\Entity\\Approval', 'a')
->where('a.action = :action')
->andWhere('a.current = :current')
->andWhere('a.userIds like \'%"' . $user_data['id'] . '"%\' ')
->setParameter('action', 3)
->setParameter('current', GeneralConstant::CURRENTLY_PENDING_APPROVAL)
->orderBy('a.createdAt', 'DESC');
if (!empty($generalFilter['entity'])) {
$qb->andWhere('a.entity = :entity')->setParameter('entity', $generalFilter['entity']);
}
$limit = max(1, $limit);
if ($page != '_UNSET_') {
$page = max(1, $page);
$offset = ($page - 1) * $limit;
} else {
$page = ceil(($offset / $limit) + 1);
}
$countQb = clone $qb;
$countQb->select('COUNT(a.id)');
$total_pending_task_count = $countQb->getQuery()->getSingleScalarResult();
$dt = $qb->setFirstResult($offset)->setMaxResults($limit)->getQuery()->getResult();
foreach ($dt as $entry) {
if (!in_array($user_data['id'], json_decode($entry->getUserIds(), true) ?? [])) {
continue;
}
$approval_data = [];
$approval_data['createdBy'] = '';
$approval_data['createdUserImage'] = '';
$approval_data['documentHash'] = $entry->getDocumentHash();
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $rl_type[$entry->getRoleType()];
$approval_data['roleTypeId'] = $entry->getRoleType();
$approval_data['createdAt'] = (int) $entry->getCreatedAt()->format('U');
$approval_data['amount'] = '';
if ($includeAbsoluteUrl == 1 && isset($absoluteUrlList[$entry->getEntity()])) {
$approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()] . '/' . $entry->getEntityId() . '?tvp=' . $tvp;
}
$approval_data['viewPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'] ?? '';
$approval_data['printPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] ?? $approval_data['viewPath'];
$approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
// Fetch document data
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
->findOneBy([
GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
]);
if ($doc) {
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0) {
$user_info = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId());
$approval_data['createdBy'] = $user_info['name'] ?? '';
$approval_data['createdUserImage'] = $user_info['image'] ?? '';
}
if (isset($amount_methods[$entry->getEntity()])) {
$approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
}
}
// $filePath = $doc->getFiles() ?? '';
$filePath = '';
if (method_exists($doc, 'getFiles')) {
$filePath = $doc->getFiles() ?: '';
}
$fileEntityName = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_name'];
$approval_data['entity'] = $entry->getEntity();
$approval_data['entityId'] = $entry->getEntityId();
$approval_data['entityIdPadded'] = str_pad($entry->getEntityId(), 8, '0', STR_PAD_LEFT);
$approval_data['required'] = $entry->getRequired();
// Real "From the document" key-facts for the mobile app (replaces the
// Lorem-Ipsum placeholder). See APPROVAL_SUMMARY_FIX.md.
$approval_data['summary'] = \ApplicationBundle\Modules\System\MiscActions::buildApprovalSummaryRows(
\ApplicationBundle\Modules\System\MiscActions::resolveApprovalPartyName($em, $entry->getEntity(), $doc),
isset($approval_data['amount']) ? $approval_data['amount'] : null,
isset($approval_data['entityIdPadded']) ? $approval_data['entityIdPadded'] : ''
);
// Project / cost-centre for the mobile grouped-approval view.
$approval_project = \ApplicationBundle\Modules\System\MiscActions::resolveApprovalProject($em, $doc);
$approval_cc = \ApplicationBundle\Modules\System\MiscActions::resolveApprovalCostCentre($em, $doc);
$approval_data['projectId'] = $approval_project['id'];
$approval_data['projectName'] = $approval_project['name'];
$approval_data['costCentreId'] = $approval_cc['id'];
$approval_data['costCentreName'] = $approval_cc['name'];
$approval_data['relatedDoc'] = strpos($filePath, '/') !== false ? $absoluteUrl . $filePath : $absoluteUrl . "uploads/$fileEntityName/" . $filePath;
$approval_data['url'] = $absoluteUrl;
$approval_data['documentImage'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? $absoluteUrl . "app_asset/default_document.svg";
$pending_approval_list[] = $approval_data;
// Group by entity
if (!isset($grouped_approval_list[$entry->getEntity()])) {
$applicableEntities[] = [
'id' => $entry->getEntity(),
'alias' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'],
'imageUrl' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? 'https://img.freepik.com/free-vector/file-searching-concept-landing-page_52683-18202.jpg',
'documentImage' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? $absoluteUrl . "app_asset/default_document.svg",
'icon' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['icon']
?? $absoluteUrl . "app_asset/icon/default.svg",
'color' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['color'] ?? '#0000FF'
];
$grouped_approval_list[$entry->getEntity()] = [];
}
$grouped_approval_list[$entry->getEntity()][] = $approval_data;
}
return [
"pending_approval_list" => $pending_approval_list,
"applicable_entities" => $applicableEntities,
"pagination" => [
"current_page" => $page,
"per_page" => $limit,
"total_items" => $total_pending_task_count,
"total_pages" => ceil($total_pending_task_count / $limit)
]
];
}
public static function getMyDocumentListForAppByUserLoginId(
$em,
$login_id,
$absoluteUrl,
$includeAbsoluteUrl = 0,
$absoluteUrlList = [],
$tvp = '',
$filterApprovalEntityId = '_all_',
$page = 1,
$limit = 10
) {
$user_data = Users::getUserInfoByLoginId($em, $login_id);
$pending_approval_list = [];
$grouped_approval_list = [];
$applicableEntities = [];
$total_pending_task_count = 0;
$generalFilter = ($filterApprovalEntityId == '_all_' || $filterApprovalEntityId == '') ? [] : [
'entity' => $filterApprovalEntityId
];
// Define reusable role and amount constants
$rl_type = GeneralConstant::$approvalRole;
$amount_methods = ApprovalConstant::$Entity_amount_method;
$qb = $em->createQueryBuilder()
->select('a')
->from('ApplicationBundle\\Entity\\Approval', 'a')
->where('a.action = :action')
// ->andWhere('a.current = :current')
->setParameter('action', 1)
// ->setParameter('current', GeneralConstant::CURRENTLY_PENDING_APPROVAL)
->orderBy('a.createdAt', 'DESC');
if (!empty($generalFilter['entity'])) {
$qb->andWhere('a.entity = :entity')->setParameter('entity', $generalFilter['entity']);
}
$page = max(1, $page);
$limit = max(1, $limit);
$offset = ($page - 1) * $limit;
$countQb = clone $qb;
$countQb->select('COUNT(a.id)');
$total_pending_task_count = $countQb->getQuery()->getSingleScalarResult();
$dt = $qb->setFirstResult($offset)->setMaxResults($limit)->getQuery()->getResult();
foreach ($dt as $entry) {
if (!in_array($user_data['id'], json_decode($entry->getUserIds(), true) ?? [])) {
continue;
}
$approval_data = [];
$approval_data['createdBy'] = '';
$approval_data['createdUserImage'] = '';
$approval_data['documentHash'] = $entry->getDocumentHash();
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $rl_type[$entry->getRoleType()];
$approval_data['roleTypeId'] = $entry->getRoleType();
$approval_data['createdAt'] = (int) $entry->getCreatedAt()->format('U');
$approval_data['amount'] = '';
if ($includeAbsoluteUrl == 1 && isset($absoluteUrlList[$entry->getEntity()])) {
$approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()] . '/' . $entry->getEntityId() . '?tvp=' . $tvp;
}
$approval_data['viewPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'] ?? '';
$approval_data['printPath'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] ?? $approval_data['viewPath'];
$approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
// Fetch document data
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
->findOneBy([
GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
]);
if ($doc) {
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0) {
$user_info = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId());
$approval_data['createdBy'] = $user_info['name'] ?? '';
$approval_data['createdUserImage'] = $user_info['image'] ?? '';
}
if (isset($amount_methods[$entry->getEntity()])) {
$approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
}
}
$filePath = $doc->getFiles();
$fileEntityName = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_name'];
$approval_data['entity'] = $entry->getEntity();
$approval_data['entityId'] = $entry->getEntityId();
$approval_data['entityIdPadded'] = str_pad($entry->getEntityId(), 8, '0', STR_PAD_LEFT);
$approval_data['required'] = $entry->getRequired();
// Real "From the document" key-facts for the mobile app (replaces the
// Lorem-Ipsum placeholder). See APPROVAL_SUMMARY_FIX.md.
$approval_data['summary'] = \ApplicationBundle\Modules\System\MiscActions::buildApprovalSummaryRows(
\ApplicationBundle\Modules\System\MiscActions::resolveApprovalPartyName($em, $entry->getEntity(), $doc),
isset($approval_data['amount']) ? $approval_data['amount'] : null,
isset($approval_data['entityIdPadded']) ? $approval_data['entityIdPadded'] : ''
);
// Project / cost-centre for the mobile grouped-approval view.
$approval_project = \ApplicationBundle\Modules\System\MiscActions::resolveApprovalProject($em, $doc);
$approval_cc = \ApplicationBundle\Modules\System\MiscActions::resolveApprovalCostCentre($em, $doc);
$approval_data['projectId'] = $approval_project['id'];
$approval_data['projectName'] = $approval_project['name'];
$approval_data['costCentreId'] = $approval_cc['id'];
$approval_data['costCentreName'] = $approval_cc['name'];
$approval_data['relatedDoc'] = strpos($filePath, '/') !== false ? $absoluteUrl . $filePath : $absoluteUrl . "uploads/$fileEntityName/" . $filePath;
$approval_data['url'] = $absoluteUrl;
$approval_data['documentImage'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? $absoluteUrl . "app_asset/default_document.svg";
$pending_approval_list[] = $approval_data;
// Group by entity
if (!isset($grouped_approval_list[$entry->getEntity()])) {
$applicableEntities[] = [
'id' => $entry->getEntity(),
'alias' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'],
'imageUrl' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? 'https://img.freepik.com/free-vector/file-searching-concept-landing-page_52683-18202.jpg',
'documentImage' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']
?? $absoluteUrl . "app_asset/default_document.svg",
'icon' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['icon']
?? $absoluteUrl . "app_asset/icon/default.svg",
'color' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['color'] ?? '#0000FF'
];
$grouped_approval_list[$entry->getEntity()] = [];
}
$grouped_approval_list[$entry->getEntity()][] = $approval_data;
}
return [
"document_list" => $pending_approval_list,
"applicable_entities" => $applicableEntities,
"pagination" => [
"current_page" => $page,
"per_page" => $limit,
"total_items" => $total_pending_task_count,
"total_pages" => ceil($total_pending_task_count / $limit)
]
];
}
// public static function getPendinDocumentListForAppByUserLoginId($em, $login_id, $includeAbsoluteUrl = 0, $absoluteUrlList = [], $tvp = '', $page = '_UNSET_', $offset = 0, $limit = 9999)
// {
// $user_data = Users::getUserInfoByLoginId($em, $login_id);
// $pending_approval_list = [];
// $override_approval_list = [];
// $grouped_approval_list = [];
// $applicableEntities = [];
// $applicableEntitiesDetails = [];
// $total_pending_task_count = 0;
//
// if ($page != '_UNSET_')
// $offset = ($page - 1) * $limit;
//
// // 1. Get total count (without LIMIT & OFFSET)
// $countQueryBuilder = $em->getRepository('ApplicationBundle\\Entity\\Approval')
// ->createQueryBuilder('w')
// ->select('COUNT(w.id)')
// ->where('(w.required =1 and w.action = 3 and w.current = 1) or (w.required =0 and w.action = 3) or (w.required =2 and w.action = 3)')
// ->andWhere('w.current =1')
// ->andWhere('w.userIds like \'%"' . $user_data['id'] . '"%\'');
//
// $totalRecords = (int)$countQueryBuilder->getQuery()->getSingleScalarResult();
//
// // 2. Calculate total pages
// $totalPages = $limit > 0 ? ceil($totalRecords / $limit) : 1;
// $currentPage = $page != '_UNSET_' ? (int)$page : 1;
//
// // 3. Fetch paginated data
// $dt = $em->getRepository('ApplicationBundle\\Entity\\Approval')
// ->createQueryBuilder('w')
// ->where('(w.required =1 and w.action = 3 and w.current = 1) or (w.required =0 and w.action = 3) or (w.required =2 and w.action = 3)')
// ->andWhere('w.current =1')
// ->andWhere('w.userIds like \'%"' . $user_data['id'] . '"%\'')
// ->orderBy('w.createdAt', 'DESC')
// ->setFirstResult($offset)
// ->setMaxResults($limit)
// ->getQuery()
// ->getResult();
//
// $rl_type = GeneralConstant::$approvalRole;
// $amount_methods = ApprovalConstant::$Entity_amount_method;
//
// foreach ($dt as $entry) {
// if (in_array($user_data['id'], json_decode($entry->getUserIds(), true))) {
// $approval_data = [];
// $approval_data['createdBy'] = '';
// $approval_data['createdUserImage'] = '';
// $approval_data['documentHash'] = $entry->getDocumentHash();
// $approval_data['approvalId'] = $entry->getId();
// $approval_data['roleType'] = $rl_type[$entry->getRoleType()];
// $approval_data['roleTypeId'] = $entry->getRoleType();
// $approval_data['createdAt'] = 1 * $entry->getCreatedAt()->format('U');
// $approval_data['amount'] = '';
//
// if ($includeAbsoluteUrl == 1 && isset($absoluteUrlList[$entry->getEntity()])) {
// $approval_data['viewPathAbs'] = $absoluteUrlList[$entry->getEntity()] . '/' . $entry->getEntityId() . '?tvp=' . $tvp;
// }
//
// $approval_data['viewPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_view_route_path_name'] : '';
// $approval_data['printPath'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name']) ? GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_print_route_path_name'] : $approval_data['viewPath'];
// $approval_data['entityAlias'] = GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'];
//
// $doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entry->getEntity()])
// ->findOneBy(
// array(
// GeneralConstant::$Entity_id_field_list[$entry->getEntity()] => $entry->getEntityId()
// )
// );
//
// if ($doc) {
// if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null) {
// $approval_data['createdBy'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['name'];
// $approval_data['createdUserImage'] = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['image'];
// }
//
// if (isset($amount_methods[$entry->getEntity()])) {
// $approval_data['amount'] = $doc->{$amount_methods[$entry->getEntity()]}();
// }
// }
//
// $approval_data['entity'] = $entry->getEntity();
// $approval_data['entityId'] = $entry->getEntityId();
// $approval_data['entityIdPadded'] = str_pad($entry->getEntityId(), 8, '0', STR_PAD_LEFT);
// $approval_data['required'] = $entry->getRequired();
// $approval_data['summary'] = GeneralConstant::$documentSummaryList;
// $approval_data['relatedDoc'] = "";
// $approval_data['documentImage'] = isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']) ?
// GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url'] : 'https://img.freepik.com/free-vector/file-searching-concept-landing-page_52683-18202.jpg';
//
// $pending_approval_list[] = $approval_data;
//
// if (!isset($grouped_approval_list[$entry->getEntity()])) {
// $applicableEntities[] = array(
// 'id' => $entry->getEntity(),
// 'alias' => GeneralConstant::$Entity_list_details[$entry->getEntity()]['entity_alias'],
// 'imageUrl' => isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']) ?
// GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url'] : 'https://img.freepik.com/free-vector/file-searching-concept-landing-page_52683-18202.jpg',
// 'documentImage' => isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url']) ?
// GeneralConstant::$Entity_list_details[$entry->getEntity()]['image_url'] : 'https://img.freepik.com/free-vector/file-searching-concept-landing-page_52683-18202.jpg',
// 'color' => isset(GeneralConstant::$Entity_list_details[$entry->getEntity()]['color']) ?
// GeneralConstant::$Entity_list_details[$entry->getEntity()]['color'] : '#0000FF'
// );
// $grouped_approval_list[$entry->getEntity()] = array();
// }
//
// $grouped_approval_list[$entry->getEntity()][] = $approval_data;
// $total_pending_task_count++;
// }
// }
//
// return array(
// "pending_approval_list" => $pending_approval_list,
// "applicable_entities" => $applicableEntities,
// "pagination" => array(
// "total_records" => $totalRecords,
// "total_pages" => $totalPages,
// "current_page" => $currentPage,
// "limit" => $limit,
// )
// );
// }
public static function decodeSignature($em, $UserId, $approveHash, $skipSig = 0)
{
// $masterAction=0;
//
// if ($approveHash=='_eco_')
// $masterAction=1;
$query_here = $em->getRepository('ApplicationBundle\\Entity\\EncryptedSignature')
->findOneBy(
array(
'userId' => $UserId
)
);
$dt = '';
if ($query_here) {
$dt = $query_here->getData();
// return 'mybad';
} else {
return false;
}
$iv = '1234567812345678';
//special use
if ($approveHash == '_eco_')
$decrypted = 'GGYmLRocksLikeABoss'; //so that it will be passed on next check
else
$decrypted = openssl_decrypt(base64_decode($dt), "AES-128-CBC", $approveHash, OPENSSL_RAW_DATA, $iv);
// return $iv;
if ($decrypted != false) {
//remove the compare code
$passed_data = '';
if (!strpos($decrypted, 'YmLRocksLikeABoss'))
return false;
// return $decrypted;
$passed_data = str_replace('YmLRocksLikeABoss', '', $decrypted);
if ($query_here->getSigExists() == 1) {
$new = $em->getRepository('ApplicationBundle\\Entity\\Signature')
->findOneBy(
array(
'id' => $query_here->getLastDecryptedSigId()
)
);
if ($new) {
return $new->getId();
} else {
$new = new Signature();
$new->setData($passed_data);
$em->persist($new);
$em->flush();
$query_here->setSigExists(1);
$query_here->setLastDecryptedSigId($new->getId());
$em->flush();
return $new->getId();
}
} else {
$new = new Signature();
$new->setData($passed_data);
$em->persist($new);
$em->flush();
$query_here->setSigExists(1);
$query_here->setLastDecryptedSigId($new->getId());
$em->flush();
return $new->getId();
}
}
// return $dt.$approveHash;
return $decrypted;
}
public static function setApprovalInfo($em, $options = [], $entity, $entity_id, $loginId, $subcat = '', $skipApprovalAction = 0, $mailModule = [])
{
if ($subcat !== '')
// if (1)
$set = $em->getRepository('ApplicationBundle\\Entity\\ApprovalSettings')
->findBy(
array(
'entity' => $entity,
'entitySub' => $subcat
)
);
else
$set = $em->getRepository('ApplicationBundle\\Entity\\ApprovalSettings')
->findBy(
array(
'entity' => $entity
)
);
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$lowest_seq = 9999;
$lowest_data = [];
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$document_hash = $doc->getDocumentHash();
$auto_created = method_exists($doc, 'getAutoCreated') ? ($doc->getAutoCreated() != 1 ? 0 : 1) : 0;
$draftFlag = method_exists($doc, 'getDraftFlag') ? ($doc->getDraftFlag() != 1 ? 0 : 1) : 0;
$currentApprovalData = array(
'userIdList' => [],
'inProcess' => 0
);
if ($draftFlag == 1)
return $currentApprovalData;
if ($auto_created == 0) {
//1st of all check if already exists and if present remove all approvals which are pending before adding the new ones
$qry = $em->getRepository('ApplicationBundle\\Entity\\Approval')->findBy(array(
'entity' => $entity,
'entityId' => $entity_id,
'action' => [3, 2] ///recently changed. was only 3 before
));
foreach ($qry as $existing) {
$em->remove($existing);
}
$em->flush();
$curr_user_id = Users::getUserFromLogin($em, $loginId)['id'];
$last_added_user_ids_for_approval = [$curr_user_id];
//now add the new ones
foreach ($set as $key => $value) {
// $expire_time=date("Y-m-d", strtotime( date( "Y-m-d", strtotime( date("Y-m-d") ) ) . "-1 month" ) )
$sto = $value->getSuccessionTimeout();
$skip = 0;
// Conditional approval layers (TODO-C): skip this layer when its
// condition is not met by the document. Fail-safe = include.
if (!ApprovalConditionEvaluator::passes($em, $entity, $doc, $value)) {
continue;
}
$new = new Approval();
$new->setEntity($value->getEntity());
$new->setEntityId($entity_id);
$new->setPositionId($value->getPositionId());
$new->setSequence($value->getSequence());
$new->setSkipPrintFlag($value->getSkipPrintFlag());
$new->setUserAssignType($value->getUserAssignType());
$new->setDocumentHash($document_hash);
// $new->setUserIds($value->getUserId()); //<-----
$new->setRoleType($value->getRoleType());
$new->setRequired($value->getRequired());
$new->setSuccession($value->getSuccession());
$new->setAction(3); //pending status
$new->setCurrent(GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL);
$new->setSuccessionTimeout($sto);
//now get the user id/s
$assign_type = $value->getUserAssignType();
$assign_type_list = GeneralConstant::$positionAssignType;
$userList = [];
if ($assign_type_list[$assign_type] == 'position') {
//get users with same positions
$userList = Users::UserListByPositionForApprovalAssign('', $value->getPositionId(), $em);
$userList = array_diff($userList, $last_added_user_ids_for_approval);
$new->setUserIds(json_encode($userList)); //<-----
}
if ($assign_type_list[$assign_type] == 'user') {
//get users with same positions
// $userList = [1 * $value->getUserId()];
$userList = explode(',', $value->getUserId());
$userList = array_diff($userList, $last_added_user_ids_for_approval);
$new->setUserIds(json_encode($userList)); //<-----
}
if ($assign_type_list[$assign_type] == 'supervisor' && !empty($last_added_user_ids_for_approval)) {
//get users with same positions
// $userList = Users::UserListBySupervisorForApprovalAssign('', $curr_user_id, $em);
$userList = Users::UserListBySupervisorForApprovalAssign(
'',
$last_added_user_ids_for_approval[0],
$em
);
$userList = array_diff($userList, $last_added_user_ids_for_approval);
$new->setUserIds(json_encode($userList)); //<-----
}
//now lets see if this should be skipped
if ($value->getRequired() != 3) { //we will not skip manual sig
if (in_array($curr_user_id, $userList))
$skip = 1;
if (empty($userList))
$skip = 1;
}
//now flushing
if ($skip == 0) {
$em->persist($new);
$em->flush();
$last_added_user_ids_for_approval = $userList;
if ($value->getSequence() < $lowest_seq && in_array($value->getRequired(), [1, 2])) {
$lowest_seq = $value->getSequence();
$lowest_data = $new;
}
} else
$last_added_user_ids_for_approval = [];
}
}
$fully_approved = self::fullyApproved($em, $entity, $entity_id, $skipApprovalAction, $mailModule);
//now set the lowest sequence as current
$currentApprovalData = array(
'userIdList' => [],
'inProcess' => 1
);
if ($fully_approved == 0) {
$lowest_data->setCurrent(GeneralConstant::CURRENTLY_PENDING_APPROVAL);
$sto = $lowest_data->getSuccessionTimeout();
if ($sto != '' && $sto != null) {
$expire_time = new \DateTimeImmutable();
$expire_time = $expire_time->modify('+' . $sto . ' hour');
$lowest_data->setSuccessionExpire($expire_time);
}
$em->flush();
$currentApprovalData['userIdList'] = json_decode($lowest_data->getUserIds(), true);
$notification_enabled = 0;
$notification_server = '';
$appId = 0;
$url = '';
if (!empty($options)) {
$notification_enabled = $options['notification_enabled'];
$notification_server = $options['notification_server'];
$appId = $options['appId'];
$url = $options['url'];
}
if (!empty($currentApprovalData['UserIdList']) && $notification_enabled == 1)
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$doc->getCompanyId(),
"Approval: " . GeneralConstant::$Entity_list_details[$entity_id]['entity_alias'] . ": " . $document_hash . " is pending Your approval",
'user',
$currentApprovalData['UserIdList'],
'information',
// GeneralConstant::$Entity_list_details[$entity_id]."/".$projectId,
$url . "/" . $entity_id,
"Approval Pending"
);
}
return $currentApprovalData;
}
public static function checkIfApprovalExists($em, $entity, $entity_id, $loginId)
{
$approval_data = array(
'exists' => 0,
'approvalId' => 0,
'roleType' => 0,
'required' => 0,
'acted' => 0,
'entity' => $entity,
'entityId' => $entity_id,
// 'debug_data'=>[]
);
///if the doc is approved then skip everything
$qry_array = array(
// 'documentHash' => $entity_name,
// 'lockFlag' => 1,
// 'CompanyId' => $user_data['company']
);
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
if ($entity_id != 0) {
$qry_array[GeneralConstant::$Entity_id_field_list[$entity]] = $entity_id;
// $qry_array['editFlag'] =[0, null]; //has to be editable so if non editable or approved then bye bye
}
$doc = $em->getRepository($className)
->findOneBy(
$qry_array
);
if ($doc) {
if ($doc->getApproved() == GeneralConstant::APPROVED) {
//now check if aany pending ones exists as doc is approved
$set = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
'required' => 0,
)
);
if (!empty($set)) {
$user_data = Users::getUserInfoByLoginId($em, $loginId);
$userList = Users::getUserListById($em, $user_data['id']);
foreach ($set as $entry) {
if ($entry->getRoleType() == 1 || $entry->getRoleType() == 2)
continue;
if (in_array($user_data['id'], json_decode($entry->getUserIds(), true) ?? [])) {
$approval_data['exists'] = 1;
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $entry->getRoleType();
$approval_data['required'] = $entry->getRequired();
$approval_data['acted'] = 1;
$approval_data['userList'] = $userList;
}
}
}
return $approval_data; // doc is approved so who cares!!!
}
else {
//else!! check for approval
$user_data = Users::getUserInfoByLoginId($em, $loginId);
$userList = Users::getUserListById($em, $user_data['id']);
$set = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
)
);
foreach ($set as $entry) {
if ($entry->getRoleType() == 1 || $entry->getRoleType() == 2)
continue;
if ($entry->getRequired() == 2 || $entry->getRequired() == 0 || $entry->getCurrent() == GeneralConstant::CURRENTLY_PENDING_APPROVAL) //override
{
$positionsArray = json_decode($entry->getUserIds(), true);
if ($positionsArray == null)
$positionsArray = [];
if (in_array($user_data['id'], $positionsArray)) {
$approval_data['exists'] = 1;
$approval_data['approvalId'] = $entry->getId();
$approval_data['roleType'] = $entry->getRoleType();
$approval_data['required'] = $entry->getRequired();
$approval_data['acted'] = 1;
$approval_data['userList'] = $userList;
}
}
// else
// if($entry->getAction()==1)//override
// {
// if(in_array($user_data['id'],json_decode($entry->getUserIds())))
// {
// $approval_data['exists']=1;
// $approval_data['approvalId']=$entry->getId();
// $approval_data['roleType']=$entry->getRoleType();
// $approval_data['required']=$entry->getRequired();
// $approval_data['acted']=1;
// }
// }
}
// $approval_data['debug_data']=[$set,$user_data];
return $approval_data;
}
}
return $approval_data;
}
public static function fullyApproved($em, $entity, $entity_id, $skipApprovalAction = 0, $mailModule = [])
{
$set = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id
)
);
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$auto_created = method_exists($doc, 'getAutoCreated') ? ($doc->getAutoCreated() != 1 ? 0 : 1) : 0;
$approved = method_exists($doc, 'getApproved') ? ($doc->getApproved() != 1 ? 0 : 1) : 0;
// if($approved!=GeneralConstant::APPROVAL_STATUS_PENDING) {
// return 0;
// }
if ($auto_created == 1) {
if ($skipApprovalAction == 0)
self::takeFullApproveActions($em, $entity, $entity_id, $mailModule);
return 1;
} else {
$fully_approved = 1;
$override = 0;
foreach ($set as $entry) {
if ($entry->getRequired() == 1) //required
{
if ($entry->getAction() == 1)
$fully_approved = $fully_approved * 1;
else
$fully_approved = $fully_approved * 0;
}
if ($entry->getRequired() == 2) //override
{
if ($entry->getAction() == 1)
$override = 1;
}
}
if ($fully_approved == 1 || $override == 1) {
if ($skipApprovalAction == 0)
self::takeFullApproveActions($em, $entity, $entity_id, $mailModule);
return 1;
} else
return 0;
}
}
public static function UpdateSuccession($em)
{
$set = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'current' => GeneralConstant::CURRENTLY_PENDING_APPROVAL,
'succession' => 1
)
);
$fully_approved = 1;
$override = 0;
$changed_data = [];
foreach ($set as $entry) {
// $entry->setCurrent(GeneralConstant::CURRENTLY_PENDING_APPROVAL);
$sto = $entry->getSuccessionTimeout();
if ($sto != '' && $sto != null) {
$expire_time = $entry->getSuccessionExpire();
$current_time = new \DateTimeImmutable();
if ($expire_time < $current_time && $expire_time != null) {
$new_time = new \DateTimeImmutable();
$new_time = $new_time->modify('+' . $sto . ' hour');
$entry->setSuccessionExpire($new_time);
//time is set now lets set the id
$userList = Users::UserListBySupervisorForApprovalAssign('', json_decode($entry->getUserIds(), true), $em);
$entry->setUserIds(json_encode($userList)); //<-----
$exp = date_format($expire_time, "Y/m/d H:i:s");
$changed_data[] = 'Approval Id ' . $entry->getDocumentHash() . ' current Time=' . $current_time->format('Y-m-d H:i:s') . ' and the expire time was ' . $exp .
' and was changed to ' . $new_time->format('Y-m-d H:i:s');
}
}
}
$em->flush();
return $changed_data;
}
public static function approveDocument($em, $options = [], $entity, $entity_id, $approvalId, $loginId, $approveAction, $approveNote, $approveHash, $url = '', $forwardTo = '', $mailModule = [])
{
$user_data = Users::getUserInfoByLoginId($em, $loginId);
$appId = $user_data['appId'];
$companyId = $user_data['companyId'];
$dt = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findOneBy(
array(
// 'entity' => $entity,
// 'entityId' => $entity_id,
'id' => $approvalId,
'action' => 3 //pending
)
);
$message = array(
'success' => true,
'userIdList' => [],
'docHash' => '',
);
if (!$dt) {
$message['success'] = false;
return $message;
}
$notification_enabled = 0;
$notification_server = '';
// $appId =0;
// $url = '';
if (!empty($options)) {
$notification_enabled = $options['notification_enabled'];
$notification_server = $options['notification_server'];
// $appId =$options['appId'];
// $url = $options['url'];
}
//if its approval decode signature and add it to dbase and pass the id
$sigId = 0;
// if($approveAction==1)
{
$sigId = self::decodeSignature($em, $user_data['id'], $approveHash);
}
if (!$sigId) {
$message['success'] = false;
return $message;
}
// return $approveHash;
//now setting the necessary data
if ($approveAction != 3) {
$dt->setSigId($sigId);
$dt->setLoginId($loginId);
$dt->setAction($approveAction);
$dt->setNote($approveNote);
$dt->setCurrent(GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL);
$em->flush();
$same_seq_list = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $dt->getEntity(),
'entityId' => $dt->getEntityId(),
'sequence' => $dt->getSequence()
)
);
foreach ($same_seq_list as $useless_data) {
if ($useless_data->getId() != $approvalId) {
$em->remove($useless_data);
$em->flush();
}
}
}
//now remove similar sequesnce
//now check if fully approved
//now the action part the prioroty is decline over all then revert and then approve
$doc = $em->getRepository('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entity])
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
// method_exists($doc, 'getAutoCreated');
$doc->setEditFlag(0); //will get locked for edit by default after 1st approval revert will open this again
$em->flush();
//decline
if ($approveAction == 0) ///if declined
{
//1st of all you cant decline a doc which is already approved and locked
if ($doc->getApproved() == 1 && $doc->getLockFlag() == 1) {
return 0;
}
//
//now notify the created and edited login id holder that doc is declined
{
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has been Declined By - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['id']],
'error',
$url . "/" . $entity_id,
"Document Declined"
);
}
if ($doc->getEditedLoginId() != null && $doc->getEditedLoginId() != '') { {
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has been Declined By - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getEditedLoginId())['id']],
'error',
$url . "/" . $entity_id,
"Document Declined"
);
}
}
//ok if not then remove all other next approvals for it
$all_seq_list = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $dt->getEntity(),
'entityId' => $dt->getEntityId(),
// 'sequence' => $dt->getSequence()
)
);
foreach ($all_seq_list as $useless_data) {
if ($useless_data->getSequence() > $dt->getSequence()) {
$em->remove($useless_data);
$em->flush();
} else {
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"The Document " . $doc->getDocumentHash() . " Has been Declined By - " . $user_data['name'],
'user',
$useless_data->getUserIds(),
'error',
$url . "/" . $entity_id,
"Document Declined"
);
}
}
//now take decline action
$decline_doc = self::takeFullDeclineActions($em, $entity, $entity_id, $mailModule);
} else if ($approveAction == 2) ///if reverted
{
//1st of all you cant edit a doc which is already approved and locked
if ($doc->getApproved() == 1 && $doc->getLockFlag() == 1) {
return 0;
}
// //also u cant edit a doc without edit flag
// if($doc->getEditFlag()==0)
// {
// return 0;
// }
{
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has been Reverted For edit By - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['id']],
'error',
$url . "/" . $entity_id,
"Document Reverted"
);
}
if ($doc->getEditedLoginId() != null && $doc->getEditedLoginId() != '') { {
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has been Reverted For edit By - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getEditedLoginId())['id']],
'error',
$url . "/" . $entity_id,
"Document Reverted"
);
}
}
$all_seq_list = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $dt->getEntity(),
'entityId' => $dt->getEntityId(),
// 'sequence' => $dt->getSequence()
)
);
foreach ($all_seq_list as $useless_data) {
if ($useless_data->getSequence() > $dt->getSequence()) {
$em->remove($useless_data);
$em->flush();
}
}
//now take revert action
$revert_doc = self::takeRevertForEditActions($em, $entity, $entity_id, $mailModule);
} else if ($approveAction == 3) ///if forwarded
{
//1st of all you cant edit a doc which is already approved and locked
if ($doc->getApproved() == 1) {
return 0;
}
// //also u cant edit a doc without edit flag
// if($doc->getEditFlag()==0)
// {
// return 0;
// }
$user_ids = json_decode($dt->getUserIds(), true);
$new_array = [];
if (in_array($user_data['id'], $user_ids)) {
$new_array = array_diff($user_ids, [$user_data['id']]);
$new_array[] = $forwardTo;
$dt->setUserIds(json_encode($new_array));
$em->flush();
// $em->remove($data_to_check);
}
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
$user_data['name'] . " Has forwarded the Document: " . $doc->getDocumentHash() . " To You for Your Approval . ",
'user',
[$forwardTo],
'information',
$url . "/" . $entity_id,
"Pending Approval"
);
} else if ($approveAction == 1) ///if approved
{
$all_seq_list = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $dt->getEntity(),
'entityId' => $dt->getEntityId(),
// 'sequence' => $dt->getSequence()
)
);
foreach ($all_seq_list as $data_to_check) {
$added_next = 0;
if ($data_to_check->getSequence() > $dt->getSequence()) {
$user_ids = json_decode($data_to_check->getUserIds(), true);
$user_ids = is_array($user_ids) ? $user_ids : [];
if (in_array($user_data['id'], $user_ids) && $data_to_check->getRequired() != 3 && $data_to_check->getRequired() != 0) // not manual or optional signature
{
$new_array = array_diff($user_ids, [$user_data['id']]);
$em->remove($data_to_check);
}
// if(empty($new_array)) {
// $em->remove($data_to_check);
// }
// else
// {
// $data_to_check->setUserIds(json_encode($new_array));
// }
$em->flush();
}
}
$fully_approved = self::fullyApproved($em, $entity, $entity_id, 0, $mailModule);
if ($fully_approved) {
//now notify the created and edited login id holder that doc is declined
{
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has Been fully Approved",
'user',
[Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['id']],
'information',
$url . "/" . $entity_id,
"Document Fully Approved"
);
}
if ($doc->getEditedLoginId() != null && $doc->getEditedLoginId() != '') { {
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has Been fully Approved.",
'user',
[Users::getUserInfoByLoginId($em, $doc->getEditedLoginId())['id']],
'information',
$url . "/" . $entity_id,
"Document Fully Approved"
);
}
}
//setting the next seq active
$next = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
'current' => 0,
'action' => [3, null],
'required' => [0]
),
array(
'sequence' => 'ASC',
)
);
if ($next) {
$next[0]->setCurrent(GeneralConstant::CURRENTLY_PENDING_APPROVAL);
if ($next[0]->getSuccession() == 1) {
$sto = $next[0]->getSuccessionTimeout();
if ($sto != '' && $sto != null) {
// $expire_time = $next[0]->getSuccessionExpire();
$current_time = new \DateTimeImmutable();
$new_time = $current_time->modify('+' . $sto . ' hour');
$next[0]->setSuccessionExpire($new_time);
}
}
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"" . $doc->getDocumentHash() . " Needs Your Approval . ",
'user',
json_decode($next[0]->getUserIds(), true),
'information',
$url . "/" . $entity_id,
"Pending Approval"
);
}
$em->flush();
} else {
//now notify the created and edited login id holder that doc is declined
{
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has Passed Approval From - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId())['id']],
'information',
$url . "/" . $entity_id,
"Document Approved"
);
}
if ($doc->getEditedLoginId() != null && $doc->getEditedLoginId() != '') { {
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"Your Document " . $doc->getDocumentHash() . " Has Passed Approval From - " . $user_data['name'],
'user',
[Users::getUserInfoByLoginId($em, $doc->getEditedLoginId())['id']],
'information',
$url . "/" . $entity_id,
"Document Approved"
);
}
}
//setting the next seq active
$next = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
'current' => 0,
'action' => [3, null],
'required' => [1, 2]
),
array(
'sequence' => 'ASC',
)
);
if ($next) {
$next[0]->setCurrent(GeneralConstant::CURRENTLY_PENDING_APPROVAL);
if ($next[0]->getSuccession() == 1) {
$sto = $next[0]->getSuccessionTimeout();
if ($sto != '' && $sto != null) {
// $expire_time = $next[0]->getSuccessionExpire();
$current_time = new \DateTimeImmutable();
$new_time = $current_time->modify('+' . $sto . ' hour');
$next[0]->setSuccessionExpire($new_time);
}
}
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$companyId,
"" . $doc->getDocumentHash() . " Needs Your Approval . ",
'user',
json_decode($next[0]->getUserIds(), true),
'information',
$url . "/" . $entity_id,
"Pending Approval"
);
}
$em->flush();
}
}
return $message;
}
public static function createEditSignatureHash($em, $entity, $entity_id, $loginId, $approveRole, $approveHash)
{
$user_data = Users::getUserInfoByLoginId($em, $loginId);
//if its approval decode signature and add it to dbase and pass the id
$sigId = 0;
if (isset($user_data['id']))
$sigId = self::decodeSignature($em, $user_data['id'], $approveHash);
else
$sigId = null;
$doc = null;
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
if ($approveRole == 1) //created
{
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$doc->setCreatedSigId($sigId);
$doc->setCreatedLoginId($loginId);
$doc->setCreatedUserId($user_data['id']);
$em->flush();
}
if ($approveRole == 2) //edited
{
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$doc->setEditedSigId($sigId);
$doc->setEditedLoginId($loginId);
$doc->setEditedUserId($user_data['id']);
$doc->setLastModifiedDate(new \DateTime());
$em->flush();
}
if (isset($user_data['id']) && $sigId != null) {
$new = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findOneBy(
array(
'roleType' => $approveRole,
'entity' => $entity,
'entityId' => $entity_id,
)
);
if (!$new)
$new = new Approval();
$new->setEntity($entity);
$new->setEntityId($entity_id);
$new->setPositionId(null);
$new->setSequence(0);
$new->setSkipPrintFlag(0);
$new->setUserAssignType(1);
$new->setDocumentHash($doc->getDocumentHash());
// $new->setUserIds($value->getUserId()); //<-----
$new->setRoleType($approveRole);
$new->setRequired(0);
$new->setSuccession(0);
$new->setAction(1); //pending status
$new->setLoginId($loginId); //pending status
$new->setCurrent(GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL);
$new->setSuccessionTimeout(0);
$new->setSigId($sigId);
$new->setNote('');
$new->setUserIds(json_encode([$user_data['id']])); //<-----
$em->persist($new);
$em->flush();
return 1;
}
//now setting the necessary data
return 0;
}
public static function getSignatureListForDocumentPrint($em, $entity, $entity_id)
{
//getting authorization lists
$authorizations = [];
$doc = $em->getRepository(isset(GeneralConstant::$Entity_fqcn_by_id[$entity]) ? GeneralConstant::$Entity_fqcn_by_id[$entity] : ('ApplicationBundle\\Entity\\' . GeneralConstant::$Entity_list[$entity]))
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$apps = $em
->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
),
array(
'sequence' => 'ASC',
)
);
$approvalRoles = GeneralConstant::$approvalRoleForPrint;
//now add additional roles form dbase
$addRoles = $em->getRepository('ApplicationBundle\\Entity\\ApprovalRole')
->findBy(
array( // 'id' => $v->getSigId()
)
);
foreach ($addRoles as $addRole) {
$approvalRoles[$addRole->getIndexId()] = $addRole->getPrintString();
}
//first the create edit sig
{
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null) {
$user = Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId());
$sig = $em->getRepository('ApplicationBundle\\Entity\\Signature')
->findOneBy(
array(
'id' => $doc->getCreatedSigId()
)
);
$q = array(
'name' => $user['name'],
'designation' => in_array($user['manualDepartment'], [null, ' ', '']) ? $user['positions'] : $user['manualDepartment'],
'auth_type' => $approvalRoles[1],
'auth' => 1,
'signature' => $sig ? $sig->getData() : ""
);
$authorizations[] = $q;
}
if ($doc->getEditedLoginId() && $doc->getEditedSigId() != null && $doc->getCreatedLoginId() != 0) {
$user = Users::getUserInfoByLoginId($em, $doc->getEditedLoginId());
$sig = $em->getRepository('ApplicationBundle\\Entity\\Signature')
->findOneBy(
array(
'id' => $doc->getEditedSigId()
)
);
$q = array(
'name' => $user['name'],
'designation' => in_array($user['manualDepartment'], [null, ' ', '']) ? $user['positions'] : $user['manualDepartment'],
'auth_type' => $approvalRoles[2],
'auth' => 1,
'signature' => $sig ? $sig->getData() : ""
);
$authorizations[] = $q;
}
}
foreach ($apps as $v) {
if ($v->getSkipPrintFlag() == 1)
continue;
if ($v->getRoleType() == 1 || $v->getRoleType() == 2)
continue;
if ($v->getAction() == GeneralConstant::APPROVED) {
$user = Users::getUserInfoByLoginId($em, $v->getLoginId());
$sig = $em->getRepository('ApplicationBundle\\Entity\\Signature')
->findOneBy(
array(
'id' => $v->getSigId()
)
);
$q = array(
'name' => $user['name'],
'designation' => in_array($user['manualDepartment'], [null, ' ', '']) ? $user['positions'] : $user['manualDepartment'],
'auth_type' => $approvalRoles[$v->getRoleType()],
'auth' => 1,
'signature' => $sig ? $sig->getData() : ""
);
$authorizations[] = $q;
} else {
$q = array(
'name' => '',
'designation' => '',
'auth_type' => $approvalRoles[$v->getRoleType()],
'auth' => in_array($v->getRequired(), [0, 3]) ? 3 : 0,
'signature' => '/uploads/Signature/pending.jpg'
);
$authorizations[] = $q;
}
}
return $authorizations;
}
public static function getDocumentLog($em, $entity, $entity_id, $CreatedloginId = 0, $EditedloginId = 0)
{
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
if(!$doc)
return array(
'log_data' => [],
'pending_data' => [],
'remaining_data' => [],
'created_data' => [],
'edited_data' => [],
'set' => [],
'docHash' => ''
);
$set = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
)
);
$roleType = GeneralConstant::$approvalRole;
// $approvalRoles=GeneralConstant::$approvalRoleForPrint;
//now add additional roles form dbase
$addRoles = $em->getRepository('ApplicationBundle\\Entity\\ApprovalRole')
->findBy(
array( // 'id' => $v->getSigId()
)
);
foreach ($addRoles as $addRole) {
$roleType[$addRole->getIndexId()] = $addRole->getName();
}
$log_data = [];
$pending_data = [];
$remaining_data = [];
$created_data = [];
$created_data['dt'] = [];
$edited_data = [];
$edited_data['dt'] = [];
if ($doc->getCreatedLoginId() && $doc->getCreatedLoginId() != 0 && $doc->getCreatedLoginId() != null)
$created_data['dt'][] = array(
'user_data' => Users::getUserInfoByLoginId($em, $doc->getCreatedLoginId()),
'action' => 1,
'date' => $doc->getCreatedAt()
);
if ($doc->getEditedLoginId() != null && $doc->getEditedLoginId() != 0)
$edited_data['dt'][] = array(
'user_data' => Users::getUserInfoByLoginId($em, $doc->getEditedLoginId()),
'action' => 1,
'date' => $doc->getLastModifiedDate()
);
// $remaining_data=[];
foreach ($roleType as $key => $value) {
$log_data[$key] = array(
'role_name' => $value,
'dt' => []
);
}
foreach ($set as $entry) {
if ($entry->getRoleType() == 1 || $entry->getRoleType() == 2)
continue;
if ($entry->getAction() != 3 && $entry->getCurrent() == GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL) {
$log_data[$entry->getRoleType()]['dt'][] = array(
'user_data' => Users::getUserInfoByLoginId($em, $entry->getLoginId()),
'action' => GeneralConstant::$approvalAction[$entry->getAction()] ?? 'unknown',
'actionId' => $entry->getAction(),
'actionColTag' => GeneralConstant::$approvalColorTag[$entry->getAction()] ?? 'orange',
'note' => $entry->getNote()
);
}
if ($entry->getAction() == 3 && $entry->getCurrent() == GeneralConstant::CURRENTLY_PENDING_APPROVAL) {
$theUserIds = json_decode($entry->getUserIds(), true);
if ($theUserIds == null)
$theUserIds = [];
foreach ($theUserIds as $item)
if ($item != null)
$pending_data['dt'][] = array(
'user_data' => Users::getUserInfoByUserId($em, $item)
);
}
if ($entry->getAction() == 3 && $entry->getCurrent() == GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL) {
$theUserIds = json_decode($entry->getUserIds(), true);
if ($theUserIds == null)
$theUserIds = [];
foreach ($theUserIds as $item)
$remaining_data['dt'][] = array(
'user_data' => Users::getUserInfoByUserId($em, $item)
);
}
}
return array(
'log_data' => $log_data,
'pending_data' => $pending_data,
'remaining_data' => $remaining_data,
'created_data' => $created_data,
'edited_data' => $edited_data,
'set' => $set,
'docHash' => $doc->getDocumentHash()
);
}
public static function takeFullApproveActions($em, $entity, $entity_id, $mailModule = [])
{
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$doc->setEditFlag(0);
$em->flush();
if ($doc->getApproved() == 1) {
} else {
$doc->setApproved(1);
$em->flush();
$all_seq_list = $em->getRepository('ApplicationBundle\\Entity\\Approval')
->findBy(
array(
'entity' => $entity,
'entityId' => $entity_id,
// 'sequence' => $dt->getSequence()
)
);
foreach ($all_seq_list as $useless_data) {
if (!in_array($useless_data->getRequired(), [0, 3])) { //not manual sig
if ($useless_data->getAction() != 1) {
$em->remove($useless_data);
$em->flush();
}
}
}
//now calling necessary function
$funcname = GeneralConstant::$Entity_list[$entity];
$approvalLog = new EntityApprovalActionLog();
$approvalLog->setEntity($entity);
$approvalLog->setEntityId($entity_id);
$approvalLog->setDocumentHash($doc->getDocumentHash());
$approvalLog->setApprovalActionStatus(2); //started
$em->persist($approvalLog);
$em->flush();
// Guard: an entity may be registered for approval (entries created via
// setApprovalInfo) without a post-approval apply hook (e.g. LoanAccount,
// where side effects happen at creation). Without this check the dynamic
// static call fatals on "undefined method". Missing hook = safe no-op.
if (method_exists(ApprovalFunction::class, $funcname)) {
ApprovalFunction::$funcname($em, $entity_id, $mailModule);
}
$approvalLog->setApprovalActionStatus(1); //completed
$em->flush();
}
return 1;
}
public static function takeFullDeclineActions($em, $entity, $entity_id, $mailModule = [])
{
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$doc->setApproved(0);
$doc->setEditFlag(0);
$doc->setLockFlag(1);
$doc->setDisabledFlag(1);
$em->flush();
//now calling necessary function
$funcname = GeneralConstant::$Entity_list[$entity];
DeclineFunction::$funcname($em, $entity_id);
return 1;
}
public static function takeRevertForEditActions($em, $entity, $entity_id, $mailModule = [])
{
$entityClassName = GeneralConstant::$Entity_fqcn_by_id[$entity] ?? GeneralConstant::$Entity_list[$entity];
$className = class_exists($entityClassName)
? $entityClassName
: 'ApplicationBundle\\Entity\\' . $entityClassName;
$doc = $em->getRepository($className)
->findOneBy(
array(
GeneralConstant::$Entity_id_field_list[$entity] => $entity_id,
)
);
$doc->setApproved(2);
$doc->setEditFlag(1);
$doc->setLockFlag(0);
$doc->setDisabledFlag(0);
$em->flush();
//now calling necessary function
$funcname = GeneralConstant::$Entity_list[$entity];
RevertFunction::$funcname($em, $entity_id);
return 1;
}
public static function getCompanyList($em)
{
$list = array();
$companies = $em->getRepository('ApplicationBundle\\Entity\\Company')->findBy(array(
'active' => GeneralConstant::ACTIVE
));
foreach ($companies as $company) {
$list[$company->getId()] = $company->getName();
}
return $list;
}
public static function UpdatePostDatedTransaction($em)
{
//1st check if a job is active
$company = $em->getRepository('ApplicationBundle\\Entity\\Company')->findOneBy(array(
'id' => 1
));
if ($company) {
if ($company->getPostDatedJobActive() == 1)
return 0; //dont interrupt
else {
$company->setPostDatedJobActive(1);
$em->flush();
}
}
/// ok get the trans
//pi
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\PurchaseInvoice')->findBy(array(
// 'approved'=>1,
// 'ledgerHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
// ApprovalFunction::PurchaseInvoice($em,$Transaction->getPurchaseInvoiceId());
//
//
//
// }
// //si
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\SalesInvoice')->findBy(array(
// 'approved'=>1,
// 'ledgerHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
// ApprovalFunction::SalesInvoice($em,$Transaction->getSalesInvoiceId());
//
//
//
// }
$noticeList = $em->getRepository('ApplicationBundle\\Entity\\SystemNotice')->findBy(array(
// 'enabled'=>GeneralConstant::ACTIVE,
// 'showAsNotification'=>GeneralConstant::ACTIVE,
// 'CompanyId'=>1,
// 'appId'=>$session->get(UserConstants::USER_COMPANY_ID),
));
foreach ($noticeList as $notice) {
$em->remove($notice);
$em->flush();
}
$notice = new SystemNotice();
$notice->setEnabled(1);
$notice->setShowAsNotification(1);
$notice->setDesc("Ledger Refreshing is Active. Until This is done, The Ledgers may not show Correct Data");
$em->persist($notice);
$em->flush();
$Transactions = $em->getRepository('ApplicationBundle\\Entity\\AccTransactions')->findBy(
array(
'approved' => 1,
'ledgerHit' => 0
),
[],
1
);
foreach ($Transactions as $Transaction) {
$partNotice = new SystemNotice();
$partNotice->setEnabled(1);
$partNotice->setShowAsNotification(1);
$partNotice->setDesc("Currently Completing Tasks on Voucher" . $Transaction->getDocumentHash());
$em->persist($partNotice);
$em->flush();
ApprovalFunction::AccTransactions($em, $Transaction->getTransactionId());
$em->remove($partNotice);
$em->flush();
}
//
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\PurchaseRequisition')->findBy(array(
// 'approved'=>3,
// 'purchaseRequisitionId'=>[40,41,42,43,44,45,46,47,48,49,50,51,52]
//// 'ledgerHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
//// $partNotice =new SystemNotice();
//// $partNotice->setEnabled(1);
//// $partNotice->setShowAsNotification(1);
//// $partNotice->setDesc("Currently Completing Tasks on Voucher".$Transaction->getDocumentHash());
//// $em->persist($partNotice);
//// $em->flush();
//
// ApprovalFunction::PurchaseRequisition($em,$Transaction->getPurchaseRequisitionId());
// $Transaction->setApproved(1);
//// $em->remove($partNotice);
// $em->flush();
//
//
//
// }
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\Grn')->findBy(array(
// 'approved'=>1,
// 'ledgerHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
// ApprovalFunction::Grn($em,$Transaction->getGrnId());
//
//
//
// }
//
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\PurchaseInvoice')->findBy(array(
// 'approved'=>1,
// 'firstHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
// $partNotice =new SystemNotice();
// $partNotice->setEnabled(1);
// $partNotice->setShowAsNotification(1);
// $partNotice->setDesc("Currently Completing Tasks on Purchase Bill".$Transaction->getDocumentHash());
// $em->persist($partNotice);
// $em->flush();
//
// Accounts::modifyAdvanceAndDuePurchaseInvoice($em,$Transaction->getPurchaseInvoiceId());
// $em->remove($partNotice);
// $em->flush();
//
//
//
//
// }
//
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\SalesInvoice')->findBy(array(
// 'approved'=>1,
// 'firstHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
//
// $partNotice =new SystemNotice();
// $partNotice->setEnabled(1);
// $partNotice->setShowAsNotification(1);
// $partNotice->setDesc("Currently Completing Tasks on Purchase Bill".$Transaction->getDocumentHash());
// $em->persist($partNotice);
// $em->flush();
//
// Accounts::modifyAdvanceAndDueSalesInvoice($em,$Transaction->getSalesInvoiceId());
// $em->remove($partNotice);
// $em->flush();
//
//
//
// }
//
//
// $invoices=$em->getRepository('ApplicationBundle\\Entity\\PurchaseInvoice')->findBy(array(
// 'approved'=>1,
// 'firstHit'=>1,
// 'ledgerHit'=>1,
// ));
//
//
//
// foreach($invoices as $invoice)
// {
// $advance_adjusted_amount=0;
// $invoice_advance_amount=$invoice->getAdvanceAmount();
// $voucherList=json_decode($invoice->getVoucherIds(),true);
// $partNotice =new SystemNotice();
// $partNotice->setEnabled(1);
// $partNotice->setShowAsNotification(1);
// $partNotice->setDesc("Currently Completing Tasks on Purchase Bill".$invoice->getDocumentHash());
// $em->persist($partNotice);
// $em->flush();
// $supp=$em->getRepository('ApplicationBundle\\Entity\\AccSuppliers')->findOneBy(array(
// 'supplierId'=>$invoice->getSupplierId(),
//
// ));
//
//
// if($voucherList!=null)
// {
// $voucherDetails=$em->getRepository('ApplicationBundle\\Entity\\AccTransactionDetails')->findBy(array(
//
// 'transactionId'=>$voucherList,
// 'accountsHeadId'=>$supp->getAdvanceHeadId()
// ));
// foreach($voucherDetails as $vdet)
// {
// if($vdet->getPosition()==AccountsConstant::CREDIT)
// $advance_adjusted_amount+=$vdet->getAmount();
// else
// $advance_adjusted_amount-=$vdet->getAmount();
//
// }
// }
//
// if($advance_adjusted_amount!=$invoice_advance_amount)
// {
// //place adjusting entry
// if ($invoice_advance_amount- $advance_adjusted_amount != 0) {
// $adjusting_amount=$invoice_advance_amount- $advance_adjusted_amount;
// $TransID = Accounts::CreateNewTransaction(0,
// $em,
// $invoice->getPurchaseInvoiceDate()->format('Y-m-d'),
// $adjusting_amount>0?$adjusting_amount:(-1)*$adjusting_amount,
// AccountsConstant::VOUCHER_JOURNAL,
// 'Journal For Advance balancing for Purchase Invoice ' . $invoice->getDocumentHash(),
// 'JV/GN/1/' . Accounts::GetVNoHash($em,'JV', 'GN', $invoice->getProjectId()),
// 'JV',
// 'GN',
// $invoice->getProjectId(),
// Accounts::GetVNoHash($em,'JV', 'GN', $invoice->getProjectId()),
// 0,
// $invoice->getCreatedLoginId(),
// $invoice->getCompanyId(),
// '',
// 0,
// 1
//
// );
//
// $curr_v_ids=json_decode($invoice->getVoucherIds(),true);
// if($curr_v_ids!=null)
// $invoice->setVoucherIds(json_encode(array_merge($curr_v_ids,array_diff( [$TransID],$curr_v_ids))));
// else
// $invoice->setVoucherIds(json_encode([$TransID]));
//
// $em->flush();
//
//
// Accounts::CreateNewTransactionDetails($em,
// '',
// $TransID,
// Generic::CurrToInt($adjusting_amount),
// $supp->getAccountsHeadId(),
// 'Generated for supplier head balance For advance',
// AccountsConstant::DEBIT,
// 0,
// [],
// [],
// $invoice->getCreatedLoginId()
// );
// Accounts::CreateNewTransactionDetails($em,
// '',
// $TransID,
// Generic::CurrToInt($adjusting_amount),
// $supp->getAdvanceHeadId(),
// 'supplier Advance Balancing ',
// AccountsConstant::CREDIT,
// 0,
// [],
// [],
// $invoice->getCreatedLoginId()
// );
// System::UpdatePostDatedTransactionById($em,$TransID);
//
//
// }
//
//
// }
//
// $em->remove($partNotice);
// $em->flush();
//
//
// }
//
// //now SI
// $invoices=$em->getRepository('ApplicationBundle\\Entity\\SalesInvoice')->findBy(array(
// 'approved'=>1,
// 'firstHit'=>1,
// 'ledgerHit'=>1,
// ));
//
//
//
// foreach($invoices as $invoice)
// {
// $advance_adjusted_amount=0;
// $invoice_advance_amount=$invoice->getAdvanceAmount();
// $voucherList=json_decode($invoice->getVoucherIds(),true);
// $partNotice =new SystemNotice();
// $partNotice->setEnabled(1);
// $partNotice->setShowAsNotification(1);
// $partNotice->setDesc("Currently Completing Tasks on Sales Bill".$invoice->getDocumentHash());
// $em->persist($partNotice);
// $em->flush();
// $supp=$em->getRepository('ApplicationBundle\\Entity\\AccClients')->findOneBy(array(
// 'clientId'=>$invoice->getClientId(),
//
// ));
//
//
// if($voucherList!=null)
// {
// $voucherDetails=$em->getRepository('ApplicationBundle\\Entity\\AccTransactionDetails')->findBy(array(
//
// 'transactionId'=>$voucherList,
// 'accountsHeadId'=>$supp->getAdvanceHeadId()
// ));
// foreach($voucherDetails as $vdet)
// {
// if($vdet->getPosition()==AccountsConstant::DEBIT)
// $advance_adjusted_amount+=$vdet->getAmount();
// else
// $advance_adjusted_amount-=$vdet->getAmount();
//
// }
// }
//
// if($advance_adjusted_amount!=$invoice_advance_amount)
// {
// //place adjusting entry
// if ($invoice_advance_amount- $advance_adjusted_amount != 0) {
// $adjusting_amount=$invoice_advance_amount- $advance_adjusted_amount;
// $TransID = Accounts::CreateNewTransaction(0,
// $em,
// $invoice->getSalesInvoiceDate()->format('Y-m-d'),
// $adjusting_amount>0?$adjusting_amount:(-1)*$adjusting_amount,
// AccountsConstant::VOUCHER_JOURNAL,
// 'Journal For Advance balancing for Sales Invoice ' . $invoice->getDocumentHash(),
// 'JV/GN/1/' . Accounts::GetVNoHash($em,'JV', 'GN', $invoice->getProjectId()),
// 'JV',
// 'GN',
// $invoice->getProjectId(),
// Accounts::GetVNoHash($em,'JV', 'GN', $invoice->getProjectId()),
// 0,
// $invoice->getCreatedLoginId(),
// $invoice->getCompanyId(),
// '',
// 0,
// 1
//
// );
//
// $curr_v_ids=json_decode($invoice->getVoucherIds(),true);
// if($curr_v_ids!=null)
// $invoice->setVoucherIds(json_encode(array_merge($curr_v_ids,array_diff( [$TransID],$curr_v_ids))));
// else
// $invoice->setVoucherIds(json_encode([$TransID]));
//
// $em->flush();
//
//
// Accounts::CreateNewTransactionDetails($em,
// '',
// $TransID,
// Generic::CurrToInt($adjusting_amount),
// $supp->getAccountsHeadId(),
// 'Generated for Client head balance For advance',
// AccountsConstant::CREDIT,
// 0,
// [],
// [],
// $invoice->getCreatedLoginId()
// );
// Accounts::CreateNewTransactionDetails($em,
// '',
// $TransID,
// Generic::CurrToInt($adjusting_amount),
// $supp->getAdvanceHeadId(),
// 'Client Advance Balancing ',
// AccountsConstant::DEBIT,
// 0,
// [],
// [],
// $invoice->getCreatedLoginId()
// );
// System::UpdatePostDatedTransactionById($em,$TransID);
//
//
// }
//
//
// }
//
// $em->remove($partNotice);
// $em->flush();
//
//
// }
//
//
//
//
$noticeList = $em->getRepository('ApplicationBundle\\Entity\\SystemNotice')->findBy(array(
// 'enabled'=>GeneralConstant::ACTIVE,
// 'showAsNotification'=>GeneralConstant::ACTIVE,
// 'CompanyId'=>1,
// 'appId'=>$session->get(UserConstants::USER_COMPANY_ID),
));
foreach ($noticeList as $notice) {
$em->remove($notice);
$em->flush();
}
if ($company) {
$company->setPostDatedJobActive(0);
$em->flush();
}
return ['done'];
}
public static function UpdatePostDatedTransactionById($em, $id)
{
// $Transactions=$em->getRepository('ApplicationBundle\\Entity\\AccTransactions')->findBy(array(
// 'approved'=>1,
// 'ledgerHit'=>0
// ));
// foreach($Transactions as $Transaction)
// {
ApprovalFunction::AccTransactions($em, $id);
// }
return ['done'];
}
public static function UpdateInvoicePayments($em)
{
$Transactions = $em->getRepository('ApplicationBundle\\Entity\\PurchaseInvoice')->findBy(array(
'approved' => 1,
'firstHit' => 0
));
foreach ($Transactions as $Transaction) {
$partNotice = new SystemNotice();
$partNotice->setEnabled(1);
$partNotice->setShowAsNotification(1);
$partNotice->setDesc("Currently Completing Tasks on Purchase Bill" . $Transaction->getDocumentHash());
$em->persist($partNotice);
$em->flush();
Accounts::modifyAdvanceAndDuePurchaseInvoice($em, $Transaction->getPurchaseInvoiceId());
$em->remove($partNotice);
$em->flush();
}
$Transactions = $em->getRepository('ApplicationBundle\\Entity\\SalesInvoice')->findBy(array(
'approved' => 1,
'firstHit' => 0
));
foreach ($Transactions as $Transaction) {
$partNotice = new SystemNotice();
$partNotice->setEnabled(1);
$partNotice->setShowAsNotification(1);
$partNotice->setDesc("Currently Completing Tasks on Purchase Bill" . $Transaction->getDocumentHash());
$em->persist($partNotice);
$em->flush();
Accounts::modifyAdvanceAndDueSalesInvoice($em, $Transaction->getSalesInvoiceId());
$em->remove($partNotice);
$em->flush();
}
$invoices = $em->getRepository('ApplicationBundle\\Entity\\PurchaseInvoice')->findBy(array(
'approved' => 1,
'firstHit' => 1,
'ledgerHit' => 1,
));
foreach ($invoices as $invoice) {
$advance_adjusted_amount = 0;
$invoice_advance_amount = $invoice->getAdvanceAmount();
$voucherList = json_decode($invoice->getVoucherIds(), true);
$partNotice = new SystemNotice();
$partNotice->setEnabled(1);
$partNotice->setShowAsNotification(1);
$partNotice->setDesc("Currently Completing Tasks on Purchase Bill" . $invoice->getDocumentHash());
$em->persist($partNotice);
$em->flush();
$supp = $em->getRepository('ApplicationBundle\\Entity\\AccSuppliers')->findOneBy(array(
'supplierId' => $invoice->getSupplierId(),
));
if ($voucherList != null) {
$voucherDetails = $em->getRepository('ApplicationBundle\\Entity\\AccTransactionDetails')->findBy(array(
'transactionId' => $voucherList,
'accountsHeadId' => $supp->getAdvanceHeadId()
));
foreach ($voucherDetails as $vdet) {
if ($vdet->getPosition() == AccountsConstant::CREDIT)
$advance_adjusted_amount += $vdet->getAmount();
else
$advance_adjusted_amount -= $vdet->getAmount();
}
}
if ($advance_adjusted_amount != $invoice_advance_amount) {
//place adjusting entry
if ($invoice_advance_amount - $advance_adjusted_amount != 0) {
$adjusting_amount = $invoice_advance_amount - $advance_adjusted_amount;
$TransID = Accounts::CreateNewTransaction(
0,
$em,
$invoice->getPurchaseInvoiceDate()->format('Y-m-d'),
$adjusting_amount > 0 ? $adjusting_amount : (-1) * $adjusting_amount,
AccountsConstant::VOUCHER_JOURNAL,
'Journal For Advance balancing for Purchase Invoice ' . $invoice->getDocumentHash(),
'JV/GN/1/' . Accounts::GetVNoHash($em, 'JV', 'GN', $invoice->getProjectId()),
'JV',
'GN',
$invoice->getProjectId(),
Accounts::GetVNoHash($em, 'JV', 'GN', $invoice->getProjectId()),
0,
$invoice->getCreatedLoginId(),
$invoice->getCompanyId(),
'',
0,
1
);
$curr_v_ids = json_decode($invoice->getVoucherIds(), true);
if ($curr_v_ids != null)
$invoice->setVoucherIds(json_encode(array_merge($curr_v_ids, array_diff([$TransID], $curr_v_ids))));
else
$invoice->setVoucherIds(json_encode([$TransID]));
$em->flush();
Accounts::CreateNewTransactionDetails(
$em,
'',
$TransID,
Generic::CurrToInt($adjusting_amount),
$supp->getAccountsHeadId(),
'Generated for supplier head balance For advance',
AccountsConstant::DEBIT,
0,
[],
[],
$invoice->getCreatedLoginId()
);
Accounts::CreateNewTransactionDetails(
$em,
'',
$TransID,
Generic::CurrToInt($adjusting_amount),
$supp->getAdvanceHeadId(),
'supplier Advance Balancing ',
AccountsConstant::CREDIT,
0,
[],
[],
$invoice->getCreatedLoginId()
);
System::UpdatePostDatedTransactionById($em, $TransID);
}
}
$em->remove($partNotice);
$em->flush();
}
//now SI
$invoices = $em->getRepository('ApplicationBundle\\Entity\\SalesInvoice')->findBy(array(
'approved' => 1,
'firstHit' => 1,
'ledgerHit' => 1,
));
foreach ($invoices as $invoice) {
$advance_adjusted_amount = 0;
$invoice_advance_amount = $invoice->getAdvanceAmount();
$voucherList = json_decode($invoice->getVoucherIds(), true);
$partNotice = new SystemNotice();
$partNotice->setEnabled(1);
$partNotice->setShowAsNotification(1);
$partNotice->setDesc("Currently Completing Tasks on Sales Bill" . $invoice->getDocumentHash());
$em->persist($partNotice);
$em->flush();
$supp = $em->getRepository('ApplicationBundle\\Entity\\AccClients')->findOneBy(array(
'clientId' => $invoice->getClientId(),
));
if ($voucherList != null) {
$voucherDetails = $em->getRepository('ApplicationBundle\\Entity\\AccTransactionDetails')->findBy(array(
'transactionId' => $voucherList,
'accountsHeadId' => $supp->getAdvanceHeadId()
));
foreach ($voucherDetails as $vdet) {
if ($vdet->getPosition() == AccountsConstant::DEBIT)
$advance_adjusted_amount += $vdet->getAmount();
else
$advance_adjusted_amount -= $vdet->getAmount();
}
}
if ($advance_adjusted_amount != $invoice_advance_amount) {
//place adjusting entry
if ($invoice_advance_amount - $advance_adjusted_amount != 0) {
$adjusting_amount = $invoice_advance_amount - $advance_adjusted_amount;
$TransID = Accounts::CreateNewTransaction(
0,
$em,
$invoice->getSalesInvoiceDate()->format('Y-m-d'),
$adjusting_amount > 0 ? $adjusting_amount : (-1) * $adjusting_amount,
AccountsConstant::VOUCHER_JOURNAL,
'Journal For Advance balancing for Sales Invoice ' . $invoice->getDocumentHash(),
'JV/GN/1/' . Accounts::GetVNoHash($em, 'JV', 'GN', $invoice->getProjectId()),
'JV',
'GN',
$invoice->getProjectId(),
Accounts::GetVNoHash($em, 'JV', 'GN', $invoice->getProjectId()),
0,
$invoice->getCreatedLoginId(),
$invoice->getCompanyId(),
'',
0,
1
);
$curr_v_ids = json_decode($invoice->getVoucherIds(), true);
if ($curr_v_ids != null)
$invoice->setVoucherIds(json_encode(array_merge($curr_v_ids, array_diff([$TransID], $curr_v_ids))));
else
$invoice->setVoucherIds(json_encode([$TransID]));
$em->flush();
Accounts::CreateNewTransactionDetails(
$em,
'',
$TransID,
Generic::CurrToInt($adjusting_amount),
$supp->getAccountsHeadId(),
'Generated for Client head balance For advance',
AccountsConstant::CREDIT,
0,
[],
[],
$invoice->getCreatedLoginId()
);
Accounts::CreateNewTransactionDetails(
$em,
'',
$TransID,
Generic::CurrToInt($adjusting_amount),
$supp->getAdvanceHeadId(),
'Client Advance Balancing ',
AccountsConstant::DEBIT,
0,
[],
[],
$invoice->getCreatedLoginId()
);
System::UpdatePostDatedTransactionById($em, $TransID);
}
}
$em->remove($partNotice);
$em->flush();
}
}
public static function getPositionIdsByDepartment($em, $DepartmentID)
{
$list = array();
$Positions = $em->getRepository('ApplicationBundle\\Entity\\SysDepartmentPosition')->findBy(array(
'status' => GeneralConstant::ACTIVE,
'departmentId' => $DepartmentID
));
foreach ($Positions as &$Position) {
$list[] = $Position->getPositionId();
}
return $list;
}
public static function sendPushNotification($deviceTokens, $path = '', $notificationTitle = "Notification Title", $notificationBody = "Notification Body", $additionalData = [])
{
//
// $google_client = new Google_Client();
//// $google_client->setClientId('916737688016-l2qfmb9p37cumudkaqpu8s7ndngq9una.apps.googleusercontent.com');
//// $google_client->setClientSecret('BEWpEBRvv3-hSoB4cGBrVB3z');
//
// $selector = BuddybeeConstant::$selector;
// $url = $this->generateUrl(
// 'applicant_login', ['refRoute' => $refRoute], UrlGenerator::ABSOLUTE_URL
// );
//
//
//
//// $this->container->getParameter('kernel.root_dir') . '/../src/ApplicationBundle/Resources/config/client_secret.json';
// $google_client->setAuthConfig($this->container->getParameter('kernel.root_dir') . '/../src/ApplicationBundle/Resources/config/client_secret.json');
//// $google_client->addScope(Google_Service\Drive::DRIVE_METADATA_READONLY);
// $google_client->setRedirectUri($url);
// $google_client->setAccessType('offline'); // offline access
// $google_client->setIncludeGrantedScopes(true); // incremental auth
//
// $google_client->addScope('email');
// $google_client->addScope('profile');
// $google_client->addScope('openid');
//
//
//// $google_client->setRedirectUri('http://localhost/applicant_login');
//
//
// //linked in 1st
//
// if (isset($_GET["code"])) {
// $token = $google_client->fetchAccessTokenWithAuthCode($_GET["code"]);
// if (!isset($token['error'])) {
// $google_client->setAccessToken($token['access_token']);
// $google_service = new Google_Service_Oauth2($google_client);
// $applicantInfo = $google_service->userinfo->get();
// $oAuthEmail = $applicantInfo['email'];
//
//
// $oAuthData = [
// 'email' => $applicantInfo['email'],
// 'uniqueId' => $applicantInfo['id'],
// 'image' => $applicantInfo['picture'],
// 'emailVerified' => $applicantInfo['verifiedEmail'],
// 'name' => $applicantInfo['givenName'] . ' ' . $applicantInfo['familyName'],
// 'firstName' => $applicantInfo['givenName'],
// 'lastName' => $applicantInfo['familyName'],
// 'type' => $token['token_type'],
// 'token' => $token['access_token'],
// ];
//
//
// }
// }
// FCM credentials loaded from file (key must NOT be committed — see client_secret_fcm.json)
$fcmKeyFile = $path . '/../src/ApplicationBundle/Resources/config/client_secret_fcm.json';
if (!file_exists($fcmKeyFile)) {
return [];
}
$data = json_decode(file_get_contents($fcmKeyFile), true);
$privateKey = $data["private_key"];
$clientEmail = $data["client_email"];
$clientId = $data["client_id"];
$authUri = $data["auth_uri"];
$tokenUri = $data["token_uri"];
// $scopes = array("https://www.googleapis.com/auth/cloud-platform");
$scopes = array("https://www.googleapis.com/auth/firebase.messaging", "https://www.googleapis.com/auth/firebase.messaging.readonly");
$scopesString = implode(" ", $scopes);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $authUri);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "client_id=$clientId&scope=$scopesString&redirect_uri=&response_type=code");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
if ($response === false) {
echo curl_error($curl);
} else {
$url = parse_url($response);
$code = $url["fragment"];
System::log_it($path, json_encode($response), 'pika_frag');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $tokenUri);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "client_id=$clientId&client_secret=$privateKey&code=$code&grant_type=authorization_code");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
if ($response === false) {
echo curl_error($curl);
} else {
$data = json_decode($response, true);
System::log_it($path, json_encode($response), 'pika_lu');
$accessToken = $data["access_token"];
// echo $accessToken;
// $serverKey = "serverKey";
// $privateKey = 'c2ec2e4808c6008d31e5d3f6a84c93e0e6dbdf9e';
$projectId = "buddybee-337909";
// $deviceToken = "DEVICE_TOKEN";
// $notificationTitle = "Notification Title";
// $notificationBody = "Notification Body";
// $pageName = "My Page";
// $data = array(
// "page_name" => $pageName,
// );
// $deviceTokens = array(
//// "DEVICE_TOKEN_1",
//// "DEVICE_TOKEN_2",
//// "DEVICE_TOKEN_3",
// );
$data = array(
// "to" => $deviceToken,
"registration_ids" => $deviceTokens,
"notification" => array(
"title" => $notificationTitle,
"body" => $notificationBody,
),
"data" => $additionalData,
);
$jsonData = json_encode($data);
// $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://fcm.googleapis.com/v1/projects/$projectId/messages:send");
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"Authorization: Bearer $accessToken",
"Content-Type: application/json",
));
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
if ($response === false) {
echo curl_error($curl);
} else {
echo $response;
}
// curl_close($curl);
}
}
curl_close($curl);
return 1;
}
public static function sendSms(
$sms_enabled_flag,
$method,
$destination_url,
$user_name_var,
$user_name,
$password_var,
$password,
$from_number_var,
$from_number,
$to_number_var,
$to_number,
$text_var,
$text,
$viewlink = ""
) {
if ($viewlink == null)
$viewlink = "";
$retData = '';
if (GeneralConstant::SMS_ENABLED == 1) {
if ($sms_enabled_flag == 1) {
if (strlen($to_number) == 11)
$to_number = '88' . $to_number;
if (strlen($to_number) == 10)
$to_number = '880' . $to_number;
if ($method == 'GET') {
$urlToCall = (strpos($destination_url, 'http') !== false) ? $destination_url : ('http://' . $destination_url);
$getStr = '';
$post_fields = array(
$user_name_var => $user_name,
$password_var => $password,
$from_number_var => $from_number,
$to_number_var => $to_number,
$text_var => $text,
);
// $to_number
$first_one = 1;
$getStr = $user_name_var . '=' . urlencode($user_name);
$getStr .= '&' . $password_var . '=' . urlencode($password);
$getStr .= '&' . $from_number_var . '=' . urlencode($from_number);
$getStr .= '&' . $to_number_var . '=' . urlencode($to_number);
$getStr .= '&' . $text_var . '=' . urlencode($text);
// $getStr .= $user_name_var . '=' . urlencode($user_name);
// foreach ($post_fields as $key => $val) {
// if ($first_one == 0) {
// $getStr .= '&';
// }
//// $getStr .= $key . '=' . urlencode($val);
//// if($key==$password_var || $key==$user_name_var)
//// if($key==$text_var )
// $getStr .= $key . '=' . urlencode($val);
//// else
//// $getStr .= $key . '=' . $val;
// $first_one = 0;
//
//
// }
// $getStr = http_build_query($post_fields);
// $getStr = urlencode($getStr);
$urlToCall = $urlToCall . '?' . $getStr;
// $urlToCall = $urlToCall . '?' . 'pika=chu&lie=pie';
// $urlToCall= http_build_query($post_fields);
// $urlToCall ='pika=chu&lie=pie';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $urlToCall,
CURLOPT_SSL_VERIFYPEER => false,
// CURLOPT_USERAGENT => 'InnoPM',
// CURLOPT_POSTFIELDS => $post_fields
));
$retData = curl_exec($curl);
$errData = curl_error($curl);
curl_close($curl);
return array(
'response' => $retData,
'errData' => $errData,
'url' => $urlToCall,
'post_fields' => $post_fields
);
} else if ($method == 'POST') {
$urlToCall = (strpos($destination_url, 'http') !== false) ? $destination_url : ('http://' . $destination_url);
$curl = curl_init();
$post_fields = array(
$from_number_var => $from_number,
$to_number_var => $to_number,
$text_var => $text,
$user_name_var => $user_name,
$password_var => $password,
);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $urlToCall,
CURLOPT_SSL_VERIFYPEER => false,
// CURLOPT_USERAGENT => 'InnoPM',
// CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $post_fields
));
$retData = curl_exec($curl);
curl_close($curl);
return array('response' => $retData, 'url' => $urlToCall, 'post_fields' => $post_fields);
}
}
}
return 0;
}
/**
* AddNewNotification — fixed implementation.
*
* Previously called the non-existent /add_notification endpoint on the Node
* server, causing all approval/document notifications to be silently dropped.
*
* Now: persists to entity_notification (DB-first) AND fires /trigger_socket
* so real-time delivery and notification history both work.
*
* $target_who_of_what must be an array of user IDs when $target_what = 'user'.
*
* @deprecated New code should call NotificationDispatcher::dispatch() instead.
* This legacy wrapper is kept for backward compatibility with
* System::approveDocument() and other existing callsites.
*/
public static function AddNewNotification(
$config_notification_enabled_flag,
$config_notification_server,
$appId,
$companyId,
$text,
$target_what,
$target_who_of_what,
$type,
$viewlink = "",
$title = "New Notification",
$em = null
) {
if ($target_who_of_what == '')
$target_who_of_what = [];
if ($viewlink == null)
$viewlink = "";
$userIds = is_array($target_who_of_what) ? $target_who_of_what : [$target_who_of_what];
$userIds = array_filter(array_map('intval', $userIds), fn($id) => $id > 0);
if (empty($userIds)) return 0;
// ── 1. Persist to DB ──────────────────────────────────────────────────
if ($em !== null) {
try {
$currTime = new \DateTime();
foreach ($userIds as $uid) {
$notif = new EntityNotification();
$notif->setAppId((int) $appId);
$notif->setCompanyId((int) $companyId);
$notif->setTitle($title);
$notif->setBody($text);
$notif->setUserId($uid);
$notif->setAssignedToUserId($uid);
$notif->setTaggedUserIds(json_encode($userIds));
$notif->setTargetUrl($viewlink);
$notif->setTargetRoute('');
$notif->setTargetId('');
$notif->setTargetPath('');
$notif->setTargetMobileAppPath('');
$notif->setNotificationTs($currTime->format('U'));
$notif->setExpireTs(0);
$notif->setSeenFlag(0);
$notif->setReadFlag(0);
$notif->setType(GeneralConstant::NOTIFICATION_TYPE_SOCKET);
$notif->setIsBuddybee(0);
$em->persist($notif);
}
$em->flush();
} catch (\Exception $e) {
// DB failure must not block the socket delivery
}
}
// ── 2. Fire socket server ─────────────────────────────────────────────
if (GeneralConstant::NOTIFICATION_ENABLED == 1 && $config_notification_enabled_flag == 1) {
$payload = json_encode([
'v' => 2,
'emitMarker' => '_SOCKET_NOTIFICATION_HERE_',
'sendType' => 'emit',
'sendToSocket' => 1,
'triggerUserIds' => array_values($userIds),
'dataObj' => [
'title' => $title,
'body' => $text,
'type' => $type,
'viewlink' => $viewlink,
],
]);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => rtrim($config_notification_server, '/') . '/trigger_socket',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_TIMEOUT_MS => 800,
CURLOPT_USERAGENT => 'InnoPM',
]);
curl_exec($curl);
curl_close($curl);
}
return 0;
}
/**
* @deprecated New code should call NotificationDispatcher::dispatch() instead.
* This legacy wrapper is kept for backward compatibility with
* existing callsites. Fixed 2026-05-27: payload is now sent as
* JSON (was form-encoded, which Node's express.json() rejected).
*/
public static function AddNewNotificationUpdated(
$config_notification_enabled_flag,
$config_notification_server,
$appId,
$companyId,
$text,
$type,
$viewlink = "",
$title = "New Notification",
$sendType = 'emit',
$addToDb = 0,
$sendToSocket = 1,
$options = [
'em' => null,
'isBuddybee' => 0,
'type' => 0,
'expireTs' => 0,
'userIdPrefixForSocket' => ''
]
) {
if ($viewlink == null)
$viewlink = "";
if ($addToDb == 1) {
$currTime = new \DateTime();
$em = $options['em'];
$NOTIFICATION = new EntityNotification();
$NOTIFICATION->setAppId($appId);
$NOTIFICATION->setCompanyId($companyId);
$NOTIFICATION->setCompanyId($companyId);
$NOTIFICATION->setBody($text);
$NOTIFICATION->setTitle($title);
$NOTIFICATION->setTargetRoute(isset($options['targetRoute']) ? $options['targetRoute'] : '');
$NOTIFICATION->setTargetUrl(isset($options['targetUrl']) ? $options['targetUrl'] : '');
$NOTIFICATION->setTargetPath(isset($options['targetPath']) ? $options['targetPath'] : '');
$NOTIFICATION->setTargetId(isset($options['targetId']) ? $options['targetId'] : '');
$NOTIFICATION->setMeetingId(isset($options['meetingId']) ? $options['meetingId'] : '');
$NOTIFICATION->setUserId(isset($options['userId']) ? $options['userId'] : '');
$NOTIFICATION->setApplicantId(isset($options['applicantId']) ? $options['applicantId'] : '');
$NOTIFICATION->setAssignedByUserId(isset($options['assignedByUserId']) ? $options['assignedByUserId'] : '');
$NOTIFICATION->setAssignedToUserId(isset($options['assignedToUserId']) ? $options['assignedToUserId'] : '');
$NOTIFICATION->setTaggedUserIds(isset($options['taggedUserIds']) ? json_encode($options['taggedUserIds']) : '[]');
$NOTIFICATION->setTargetMobileAppPath(isset($options['targetRoute']) ?
(isset(GeneralConstant::$MOBILE_APP_PATH_BY_ROUTING[$options['targetRoute']]) ? GeneralConstant::$MOBILE_APP_PATH_BY_ROUTING[$options['targetRoute']] : '')
: '');
$NOTIFICATION->setExpireTs(isset($options['expireTs']) ? $options['expireTs'] : 0);
$NOTIFICATION->setNotificationTs(isset($options['notificationTs']) ? $options['notificationTs'] : $currTime->format('U'));
$NOTIFICATION->setIsBuddybee(isset($options['isBuddybee']) ? $options['isBuddybee'] : 0);
$NOTIFICATION->setType(isset($options['type']) ? $options['type'] : 0);
$NOTIFICATION->setSeenFlag(0);
$NOTIFICATION->setReadFlag(0);
$em->persist($NOTIFICATION);
$em->flush();
if (GeneralConstant::NOTIFICATION_ENABLED == 1) {
if ($config_notification_enabled_flag == 1) {
$curl = curl_init();
$arrayToSend = array(
'sendType' => $sendType,
'dataObj' => isset($options['dataObj']) ? $options['dataObj'] : [],
// 'firebasePushData' => isset($options['firebasePushData']) ? $options['firebasePushData'] :null,
'emitMarker' => isset($options['emitMarker']) ? $options['emitMarker'] : '_NONE_',
'triggerUserIds' => isset($options['taggedUserIds']) ? $options['taggedUserIds'] : [], //'pos', 'all', 'user','none',
);
if (isset($options['firebasePushData']))
$arrayToSend['firebasePushData'] = $options['firebasePushData'];
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $config_notification_server . '/trigger_socket',
CURLOPT_USERAGENT => 'InnoPM',
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($arrayToSend),
CURLOPT_TIMEOUT_MS => 800,
));
curl_exec($curl);
curl_close($curl);
return 0;
}
}
}
if ($sendToSocket == 1) // if (0)
{
if (GeneralConstant::NOTIFICATION_ENABLED == 1) {
if ($config_notification_enabled_flag == 1) {
$curl = curl_init();
$arrayToSend = array(
'sendType' => $sendType,
'sendToSocket' => $sendType == '' ? 0 : 1,
'dataObj' => isset($options['dataObj']) ? $options['dataObj'] : [],
// 'firebasePushData' => isset($options['firebasePushData']) ? $options['firebasePushData'] :null,
'emitMarker' => isset($options['emitMarker']) ? $options['emitMarker'] : '_NONE_',
'triggerUserIds' => isset($options['taggedUserIds']) ? $options['taggedUserIds'] : [], //'pos', 'all', 'user','none',
);
if (isset($options['firebasePushData']))
$arrayToSend['firebasePushData'] = $options['firebasePushData'];
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $config_notification_server . '/trigger_socket',
CURLOPT_TIMEOUT_MS => 800,
CURLOPT_USERAGENT => 'InnoPM',
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($arrayToSend),
));
curl_exec($curl);
curl_close($curl);
return 0;
}
}
}
return 0;
}
public static function SendSmsBySocket($config_notification_enabled_flag, $msg, $phoneNumber, $emitMarker, $sendType, $socketUserIds, $deviceId = "_DEFAULT_")
{
if (GeneralConstant::NOTIFICATION_ENABLED == 1) {
if ($config_notification_enabled_flag == 1) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://www.' . GeneralConstant::BUDDYBEE_SOCKET_SERVER . '/trigger_socket',
// CURLOPT_URL => 'http://localhost:5321/trigger_socket',
CURLOPT_USERAGENT => 'InnoPM',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => http_build_query(array(
'sendType' => $sendType,
'dataObj' => array(
'message' => $msg,
'phoneNumber' => $phoneNumber,
'deviceId' => $deviceId,
),
'emitMarker' => $emitMarker,
'triggerUserIds' => $socketUserIds, //'pos', 'all', 'user','none',
))
));
curl_exec($curl);
curl_close($curl);
return 1;
}
}
return 0;
}
public static function GetAllNotification($config_notification_enabled_flag, $config_notification_server, $user_id = 0, $appId = 0, $companyId = 0)
{
$ret = "";
$curl = [];
$serverhost = '';
if (GeneralConstant::NOTIFICATION_ENABLED == 1) {
if ($config_notification_enabled_flag == 1) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
// CURLOPT_URL => GeneralConstant::NOTIFICATION_SERVER . '/get_all_notification',
CURLOPT_URL => $config_notification_server . '/get_all_notification',
CURLOPT_USERAGENT => 'InnoPM',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
'user' => $user_id,
'companyId' => $companyId,
'appId' => $appId,
)
));
$ret = curl_exec($curl);
curl_close($curl);
// return json_encode([$ret,"http://".($config_notification_server=='localhost:5000'?'localhost:5000':$config_notification_server)]);
return $ret;
}
}
return $ret;
}
public static function log_it($root_dir, $to_write, $file_name, $append = 1)
{
$upl_dir = $root_dir . '/../web/mylogs/';
// $upl_dir = $this->container->getParameter('kernel.root_dir') . '/../web/uploads/FileUploads/';
if (!file_exists($upl_dir)) {
mkdir($upl_dir, 0777, true);
}
$file = $upl_dir . $file_name . ".txt";
// $file = $uploadedFile->move($upl_dir, $path);
if ($append == 1)
$write_file = file_put_contents($file, $to_write, FILE_APPEND);
else
$write_file = file_put_contents($file, $to_write);
}
public static function setNocApprovalInfo($em, $entity_id)
{
$doc = $em->getRepository(NocApproval::class)->find($entity_id);
$employeeDetailsRepo = $em->getRepository(EmployeeDetails::class);
$applicant = $employeeDetailsRepo->find($doc->getEmployeeId());
$nocApprovalSett = json_decode($applicant->getNocApproval(), true);
$employeeRepo = $em->getRepository(Employee::class);
$sysUserRepo = $em->getRepository(SysUser::class);
$usersWhoApprove = [];
$entity = array_flip(GeneralConstant::$Entity_list)['NocApproval'];
$skipApprovalAction = 0;
$lowest_seq = 9999;
$lowest_data = [];
if ($nocApprovalSett == null)
$nocApprovalSett = [];
// foreach ($nocApprovalSett as $nocAppUser) {
// $department = $nocAppUser->department;
// $designation = $nocAppUser->designation;
// $userWhoApprove = $employeeDetailsRepo->findOneBy(['desg' => $designation]);
// $usersWhoApprove[] = $userWhoApprove;
// }
$documentHash = $doc->getDocumentHash();
$autoCreated = method_exists($doc, 'getAutoCreated') ? ($doc->getAutoCreated() != 1 ? 0 : 1) : 0;
// if ($autoCreated == 0)
{
$qry = $em->getRepository('ApplicationBundle\\Entity\\Approval')->findBy(array(
'entity' => $entity,
'entityId' => $entity_id,
'action' => [3, 2] ///recently changed. was only 3 before
));
foreach ($qry as $existing) {
$em->remove($existing);
}
$em->flush();
foreach ($nocApprovalSett as $key => $nocAppsett) {
if ($nocAppsett['designation'] == "")
continue;
$approval = new Approval();
$approval->setEntity($entity);
$approval->setEntityId($entity_id);
$approval->setPositionId(1);
$approval->setSequence(++$key);
$approval->setSkipPrintFlag(0);
$approval->setUserAssignType(1);
$approval->setDocumentHash($documentHash);
$approval->setRoleType(5);
$approval->setRequired(1);
$approval->setSuccession(0);
$approval->setAction(3);
$approval->setCurrent(GeneralConstant::CURRENTLY_NON_PENDING_APPROVAL);
$approval->setSuccessionTimeout('');
$em->persist($approval);
$em->flush();
$userList = Users::UserListByPositionForApprovalAssign('', $nocAppsett['designation'], $em);
$approval->setUserIds(json_encode($userList));
if (++$key < $lowest_seq && in_array(1, [1, 2])) {
$lowest_seq = ++$key;
$lowest_data = $approval;
}
}
$fully_approved = self::fullyApproved($em, $entity, $doc->getId(), $skipApprovalAction);
$currentApprovalData = array(
'userIdList' => []
);
if ($fully_approved == 0) {
$lowest_data->setCurrent(GeneralConstant::CURRENTLY_PENDING_APPROVAL);
$sto = $lowest_data->getSuccessionTimeout();
if ($sto != '' && $sto != null) {
$expire_time = new \DateTimeImmutable();
$expire_time = $expire_time->modify('+' . $sto . ' hour');
$lowest_data->setSuccessionExpire($expire_time);
}
$em->flush();
$currentApprovalData['userIdList'] = json_decode($lowest_data->getUserIds(), true);
$notification_enabled = 0;
$notification_server = '';
$appId = 0;
$url = '';
if (!empty($options)) {
$notification_enabled = $options['notification_enabled'];
$notification_server = $options['notification_server'];
$appId = $options['appId'];
$url = $options['url'];
}
if (!empty($currentApprovalData['UserIdList']) && $notification_enabled == 1)
System::AddNewNotification(
$notification_enabled,
$notification_server,
$appId,
$doc->getCompanyId(),
"Approval: " . GeneralConstant::$Entity_list_details[$entity]['entity_alias'] . ": " . $documentHash . " is pending Your approval",
'user',
$currentApprovalData['UserIdList'],
'information',
$url . "/" . $entity,
"Approval Pending"
);
}
return $currentApprovalData;
}
}
}