Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
bulkpayrolltest.php
Package: ck-erp-0.29.1.tar.gz [view]
Upload User: mnp333
Upload Date: 2019-02-07
Package Size: 1618k
Code Size: 6k
Category:
Java Develop
Development Platform:
Java
- <?php
- //
- // CK-ERP -- Copyright (C) 2004 - 2009 Wu Chiu Kay
- // ------------------------------------------------------
- // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
- //
- // bulkpayrolltest.php 0.29.1 2009/01/31 C K Wu
- $app = 'ck-payroll' ;
- $tran = $class = 'bulkpayroll' ;
- require_once('../ck-api/ckapi.inc.php') ;
- $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id'])?$_POST['id']:'');
- $filter = isset($_GET['filter']) ? $_GET['filter'] : (isset($_POST['filter'])?$_POST['filter']:'');
- $period = isset($_GET['period']) ? $_GET['period'] : (isset($_POST['period'])?$_POST['period']:'');
- $datefrom = isset($_GET['datefrom']) ? $_GET['datefrom'] : (isset($_POST['datefrom'])?$_POST['datefrom']:'');
- $dateto = isset($_GET['dateto']) ? $_GET['dateto'] : (isset($_POST['dateto'])?$_POST['dateto']:'');
- $filter=stripslashes($filter);
- $gp = newobj($app,$class) ;
- $t = exapi_tpl($app);
- $t->set_file('report','bulkpayrollscreen.tpl') ;
- $t->set_file('screen','journalscreen.tpl') ;
- $t->set_block('report','detail','detail_section');
- $t->set_block('screen','journal','journal_section');
- $t->set_var('lang_title',exapi_lang('Test Run on Current Period Payroll Generation'));
- $msg1 = exapi_lang('When actually generating period payroll, make sure the period from/to dates are accurate.');
- $msg2 = exapi_lang("Inaccurate Date will affect subsequent period's payroll.");
- $t->set_var('message',"<b>$msg1<br>$msg2</b>") ;
- $t->set_var('readonly','readonly');
- $t->set_var('disabled','');
- /*------------- Write Journal to Screen Display ----------------------------*/
- $p['datefrom'] = $datefrom ;
- $p['dateto'] = $dateto ;
- $gp->bulkpayroll_header_write($t, $p) ;
- $float = ($ckapi['hostsys']['dbtype']=="mysql") ? "double" : "float" ;
- $ck_user = $ckapi['hostsys']['username'];
- $temp = "${pre}pyr".$ck_user.time() ;
- $temp1 = "${pre}pyr1".$ck_user.time() ;
- $creattempsql = "CREATE TABLE $temp (pyrcodeid int,amount $float)" ;
- $adodb->query("CREATE TABLE $temp1 as SELECT * FROM ${pre}pyrohist WHERE 1<>1");
- $where = "WHERE empid=b.id" ;
- if ($period<>'') $where = "$where and period='$period'" ;
- $ck_sql = "SELECT a.id as id,empid,salary,period,chart_id,bankac,bankacname " ;
- $ck_sql.= "FROM ${pre}payroll a,${pre}employee b $where" ;
- $result = $adodb->query($ck_sql);
- For ($i=1;$arr[$i]=$result->fetchRow();$i++) ;
- $tot_recur = $tot_nonrecur = $tot_reductn = $tot_net = $tot_contri = 0 ;
- For ($j=1;isset($arr[$j]['id']);$j++) {
- $p = $arr[$j] ;
- $id = ($p['id']=='') ? 0 : $p['id'] ;
- $p['empid'] = ($p['empid']=='') ? 0 : $p['empid'] ;
- $p['temp'] = $temp ;
- $p['temp1'] = $temp1 ;
- $p['creattempsql'] = $creattempsql ;
- $result = $adodb->query("SELECT * FROM ${pre}pyrc_trans WHERE pyroid='$id' ORDER BY id");
- For ($i=1;$rs=$result->fetchRow();$i++) {
- $p['eaid'.$i] = $rs['pyrcodeid'] ;
- $p['qty'.$i] = $rs['qty'] ;
- $p['rate'.$i] = $rs['rate'] ;
- $p['amount'.$i] = $rs['amount'] ;
- $p['comment'.$i] = $rs['comment'] ;
- $p['chart_id'.$i] = $rs['chart_id'] ;
- }
- $result = $adodb->query("SELECT * FROM ${pre}pynr_trans WHERE empid='$p[empid]' and approved_by<>'' ORDER BY id");
- For ($i=1;$rs=$result->fetchRow();$i++) {
- $p['nreaid'.$i] = $rs['pyrcodeid'] ;
- $p['nrapproved_by'.$i] = $rs['approved_by'] ;
- $p['nrqty'.$i] = $rs['qty'] ;
- $p['nrrate'.$i] = $rs['rate'] ;
- $p['nramount'.$i] = $rs['amount'] ;
- $p['nrcomment'.$i] = $rs['comment'] ;
- $p['nrchart_id'.$i] = $rs['chart_id'] ;
- }
- $ck_sql = "SELECT rdtnid,chart_id FROM ${pre}rdtn_trans a,${pre}reductn b " ;
- $ck_sql.= "WHERE pyroid='$id' and rdtnid=b.id ORDER BY a.id";
- $result = $adodb->query($ck_sql);
- For ($i=1;$rs=$result->fetchRow();$i++) {
- $p['rdtnid'.$i] = $rs['rdtnid'] ;
- $p['rdchart_id'.$i] = $rs['chart_id'] ;
- }
- $ck_sql = "SELECT cntrid,ac_exp,ac_liab FROM ${pre}cntr_trans a,${pre}contri b " ;
- $ck_sql.= "WHERE pyroid='$id' and cntrid=b.id ORDER BY a.id" ;
- $result = $adodb->query($ck_sql);
- For ($i=1;$rs=$result->fetchRow();$i++) {
- $p['cntrid'.$i] = $rs['cntrid'] ;
- $p['ac_exp'.$i] = $rs['ac_exp'] ;
- $p['ac_liab'.$i] = $rs['ac_liab'] ;
- }
- $gp->bulkpayroll_detail_write($t, $p);
- $tot_recur += $p['recur'] ;
- $tot_nonrecur += $p['nonrecur'] ;
- $tot_reductn += $p['reductn'] ;
- $tot_net += $p['net'] ;
- $tot_contri += $p['contri'] ;
- }
- $t->set_var('tot_recur',$tot_recur) ;
- $t->set_var('tot_nonrecur',$tot_nonrecur) ;
- $t->set_var('tot_reductn',$tot_reductn) ;
- $t->set_var('tot_net',$tot_net) ;
- $t->set_var('tot_contri',$tot_contri) ;
- /*--------------------Write bottom Section------------------------------------------*/
- $getstr = "id=$id&filter=$filter" ;
- $t->set_var('action',exapi_link("/ck-payroll/bulkpayrollfilter.php",$getstr));
- $t->set_var('done_action',exapi_link("/ck-payroll/bulkpayrollfilter.php",$getstr));
- $t->set_var('lang_done',exapi_lang('Done'));
- $t->pparse('out','report',True);
- //---- Generate Payroll journal
- $lang_payperiod = exapi_lang('Payroll for period') ;
- $lang_from = exapi_lang('*from*') ;
- $lang_to = exapi_lang('*to*') ;
- $t->set_var('lang_jtitle',exapi_lang('Payroll Journal to be Generated'));
- $jl['source'] = "PYRO" ;
- $jl['description'] = "$lang_payperiod $lang_from::$datefrom $lang_to::$dateto" ;
- $jl['transdate'] = date("Y-m-d") ;
- $gp->journal_header_write($t, $jl) ;
- $ck_sql = "SELECT chart_id,sum(amount) as amount FROM $temp1 a, ${pre}chart b " ;
- $ck_sql.= "WHERE a.chart_id=b.id GROUP BY chart_id ORDER BY chart_id";
- $result = $adodb->query($ck_sql);
- $i=1;
- while ($rs=$result->fetchRow()) {
- $jl['accno'.$i] = $rs['chart_id'] ;
- $jl['attrib1'.$i] = isset($rs['attrib1']) ? $rs['attrib1'] : '' ;
- $jl['attrib2'.$i] = isset($rs['attrib2']) ? $rs['attrib2'] : '' ;
- $jl['attrib3'.$i] = isset($rs['attrib3']) ? $rs['attrib3'] : '' ;
- $cr = sprintf($ck_nbrfmt,$rs['amount']);
- $dr = sprintf($ck_nbrfmt,-$cr) ;
- if ($cr>0) {$dr='';} else {$cr='';}
- $jl['dr'.$i] = $dr ;
- $jl['cr'.$i] = $cr ;
- $i++ ;
- }
- $gp->journal_detail_write($t,$jl,True);
- $adodb->query("DROP TABLE $temp1");
- $t->pparse('out','screen',True);
- ck_footer() ;
- ?>