<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system.  The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.).  Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);

/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/

define('FOPEN_READ',							'rb');
define('FOPEN_READ_WRITE',						'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE',		'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE',	'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE',					'ab');
define('FOPEN_READ_WRITE_CREATE',				'a+b');
define('FOPEN_WRITE_CREATE_STRICT',				'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT',		'x+b');

/**** USER DEFINED CONSTANTS **********/

define('ROLE_ADMIN',                            '1');
define('ROLE_MANAGER',                         	'2');
define('ROLE_EMPLOYEE',                         '3');
/*define('ROLE_PRODUCTION',                       '4');
define('ROLE_QUALITY',                        	'5');*/
define('ROLE_SECURITY',                         '6');
/*define('ROLE_SALES',	                        '7');
define('ROLE_ACCOUNTS',                         '8');*/


define('SEGMENT',								2);

/**************  Requistion Status code                 */
define('REQ_DRAFT',                            'ST001');
define('REQ_PENDING_APPROVAL',                 'ST002');
define('REQITEM_NEW',                          'ST003');
define('REQ_APPROVED',                         'ST004');
define('REQ_PO_CREATED' ,                       'ST005');
define('REQ_REJECTED',                          'ST006');
define('REQ_CLOSED',                            'ST007');
define('REQ_ONHOLD',                            'ST008');
define('REQITEM_ONHOLD',                        'ST009');
define('REQITEM_PARTIALLY_DELIVERED',           'ST010');
define('REQITEM_DELIVERED',                     'ST011');
define('REQ_DELETED',                     'ST013');
define('REQITEM_POCREATED',                     'ST022');
define('REQITEM_PARTIALLY_PO_CREATED',                     'ST023');
define('REQITEM_Emergency_PO_CREATED',                     'ST024');


define('REQUISTSTATUS',                     '0');
define('REQUISTITEMSTATUS',                     '1');

/* Purchase Order Status */

define('PO_DRAFT',                            'ST014');
define('PO_CREATED',                          'ST015');
define('PO_INPROGRESS',                       'ST016');
define('PO_DISPATCHED',                       'ST017');
define('PO_DELIVERED',                        'ST018');
define('PO_CANCELLED',                        'ST019');
define('PO_ONHOLD',                           'ST020');
define('PO_CLOSED',                           'ST021');


/* Department Code */
define('ADMIN',                            			'DEP01');
define('QUALITY',                            		'DEP02');
define('STORE',                            			'DEP03');
define('SALES',                            			'DEP04');
define('PRODUCTION',                            	'DEP05');
define('DELIVERY',                            		'DEP06');
define('TRP',                            			'DEP07');
define('COATING',                            		'DEP08');
define('MAINTENANANCE',                            	'DEP09');
define('FINANCE',                            		'DEP10');
define('PURCHASE',                            		'DEP11');
define('MANAGEMENT',                            		'DEP12');
/* PO Type  */
define('REVENUE',                            		'REVENUE');
define('SERVICE',                            		'SERVICE');
define('IMPORT',                            		'IMPORT');
define('CAPITAL',                            		'CAPITAL');

// Tax Type
define('PERCENTAGE',                            		'PERCENTAGE');
define('LUMPSUM',                            		'LUMP SUM');
define('NILTYPE',                            		'NIL');

// Freight Type
define('PERUOM',                            		'PER UOM');
define('PERTRIP',                            		'PER TRIP');


/*  Formula for Tax calculation */
/* Discount*/
define('DIS_PERCENTAGE',                            		'((Discountval/100) * basicValue)');
define('DIS_LUMPSUM',                            		    'Discountval');
// Packaging
define('PACKAGING_PERCENTAGE_BYDISCOUNTVALUE',             		'((Packagingvalue/100) * (basicValue-AfterDiscount))');
define('PACKAGING_PERCENTAGE_BYBASICVALUE',                            		'(Packagingvalue/100) * basicValue');
define('PACKAGING_LUMPSUM_BYDISCOUNTVALUE',             		'Packagingvalue');
define('PACKAGING_LUMPSUM_BYBASICVALUE',                            		'Packagingvalue');
//Excise
define('EXCISE_ONBASICVALUE',                            		'((ExciseDuty/100) * basicValue)');
define('EXCISE_ONBASIC_DISCOUNT',                            		'((ExciseDuty/100) * (basicValue-AfterDiscount))');
define('EXCISE_ONBASIC_DISCOUNT_PACKAGING',                      '((ExciseDuty/100) * ((basicValue-AfterDiscount)+ AfterPackaging))');
define('EXCISE_ONBASIC_PACKAGING',                            		'((ExciseDuty/100) * (basicValue + AfterPackaging))');


//Vat
define('VAT_ONBASICVALUE',                            		'((vatValue/100) * basicValue)');
//define('VAT_ONEXICSEVALUE',                            		'((vatValue/100) * (basicValue+ExciseDuty))');
define('VAT_ONEXICSEVALUE',                            		'(((basicValue - discountValue) + (packageValue + ExciseDuty)) * (vatValue/100))');

//CST
define('CST_ONBASICVALUE',                            		'((CSTValue/100) * basicValue)');
//define('CST_ONEXICSEVALUE',                            		'((CSTValue/100) * (basicValue+ExciseDuty))');
define('CST_ONEXICSEVALUE',                            		'(((basicValue - discountValue) + (packageValue + ExciseDuty)) * (CSTValue/100))');
//GST
define('GSTTAX',                            				'((GSTValue/100) * basicValue)');
//Other Tax
define('OTHERTAX',                            				'((OtherTaxValue/100) * basicValue)');
//Freight Tax
define('FREIGHT_PERCENTAGE',                            			'((FreightValue/100) * basicValue)');
define('FREIGHT_LUMPSUM',                            				'FreightValue');
define('FREIGHT_PERUOM',                            				'FreightValue * Quantity');
define('FREIGHT_PERTRIP',                            				'FreightValue');

/*           SERVICE PO VARIABLES    */
define('SERVICETAX_SERVICETAX_14PERCENT',                            			'((14/100) * basicValue)');
define('SERVICETAX_EDUCESS_2PERCENT',                            			'((2/100) * ServiceTaxAmount)');
define('SERVICETAX_HIGHEREDUCESS_1PERCENT',                            			'((1/100) * ServiceTaxAmount)');
define('SERVICETAX_KRISHIKALYAN',                            			'(((.5)/100) * basicValue)');
define('SERVICETAX_SWACHHBHARAT',                            			'(((.5)/100) * basicValue)');

/*IMPORT PO CALCULATIONS*/


define('LOADING_CHARGE',                                            '(txtlanding*txtbasicprice/100)');
define('HIGHSEAS_SALES',                                  '(totalhighsess*highsesspercentage/100)');
define('CUSTOM_DUTY',                                     '(sumcustom*txtcustompercentage)/100');
define('EXCISE_DUTY',                                      '(txtexcisesum*txtpercentage)/100');
define('EXCISE_ED',                                        '(txtexcise*txtexcisepercentage)/100');
define('EXCISE_SH',                                        '(excisetxt*exciseshcess)/100');
define('CUSTOM_ED',                                        '(totalval*txtedcesspercentage)/100');
define('CUSTOM_SH',                                        '(totcustomsh*txtshpercentage)/100');
define('ADDTNL_EXCISEDUTY',                                '(totaddtnlexcise*addtnpercentage)/100');
define('GROSS_EXP',                                        '(txtgrossdutypayable-txtmodvat)');
define('AVL_MODVAT',                'txtexciseduty1+txtexciseedcess+txtexciseshcess+txtaddtnlexcise');
define('GROSS_DUTY',   'landingcha+highsesssalless+customcha+excisecha+exciseedcha+exciseshcha+customed+customsh+txtaddtnexciseduty');
define('PURCHASE_RATE',                                    'txtbasicinrprice/txtCtablequantity');
define('CUSTOMDUTY_EXP',                                   'txtgrossexp/txtCtablequantity');
define('RMC_CAL',                                          'txtpurchaserate+txtcustomdutyexp');
define('CALCULATE_TOTAL',                                  '(txtrmc*quantity)+basicprice');
/* Capital Po Calculations */
define('Capital_Landing_Charge',                                            'basicPrice*(landCharge/100)');
define('Capital_Highseas_Charge',                                            '(basicPrice+afterLandingCharge)*(highSeas/100)');



/* End of file constants.php */
/* Location: ./application/config/constants.php */
