コード例 #1
0
ファイル: functions.php プロジェクト: DinethH/FindYourTutor
function dateInUS($string)
{
    $date = explode("-", $string);
    $day = $date[2];
    $year = $date[0];
    $month = getMonthName($date[1]);
    $dateInUS = $month . " " . $day . ", " . $year;
    return $dateInUS;
}
コード例 #2
0
function printSupp()
{
    # Set up table to display in
    global $PRDMON;
    $cur = date("m");
    $from = getMonthName($PRDMON[1]) . " " . getYearOfFinMon($PRDMON[1]);
    $to = getMonthName($cur) . " " . getYearOfFinMon($cur);
    $printSupp = "\n\t\t<h3>Creditors Age Analysis</h3>\n\t\t<h4>Period: {$from} to {$to}</h4>\n\t\t<li class='err'>Please note that because age analysis is calculated and stored as is displayed below it is not\n\t\tpossible to change the period for which you wish to see the age analysis.</li>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Acc no.</th>\n\t\t\t\t<th>Suppliers</th>\n\t\t\t\t<th>Current</th>\n\t\t\t\t<th>30 days</th>\n\t\t\t\t<th>60 days</th>\n\t\t\t\t<th>90 days</th>\n\t\t\t\t<th>120 days</th>\n\t\t\t\t<th>Total Outstanding</th>\n\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM suppliers WHERE div = '" . USER_DIV . "' ORDER BY supname ASC";
    $suppRslt = db_exec($sql) or errDie("Unable to retrieve Suppliers from database.");
    if (pg_numrows($suppRslt) < 1) {
        return "<li>There are no Suppliers in Cubit.</li>";
    }
    # totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($supp = pg_fetch_array($suppRslt)) {
        # Get all ages
        $curr = age($supp['supid'], 29);
        $age30 = age($supp['supid'], 59);
        $age60 = age($supp['supid'], 89);
        $age90 = age($supp['supid'], 119);
        $age120 = age($supp['supid'], 149);
        # Suppliers total
        $supptot = sprint($curr + $age30 + $age60 + $age90 + $age120);
        if ($supptot < $supp['balance']) {
            $curr = sprint($curr + ($supp['balance'] - $supptot));
            $supptot = sprint($supptot + $supp['balance'] - $supptot);
        }
        $printSupp .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$supp['supno']}</td>\n\t\t\t\t<td>{$supp['supname']}</td>\n\t\t\t\t<td>" . CUR . " {$curr}</td>\n\t\t\t\t<td>" . CUR . " {$age30}</td>\n\t\t\t\t<td>" . CUR . " {$age60}</td>\n\t\t\t\t<td>" . CUR . " {$age90}</td>\n\t\t\t\t<td>" . CUR . " {$age120}</td>\n\t\t\t\t<td>" . CUR . " {$supptot}</td>\n\t\t\t</tr>";
        # hold totals
        $totcurr += $curr;
        $tot30 += $age30;
        $tot60 += $age60;
        $tot90 += $age90;
        $tot120 += $age120;
        $alltot += $supptot;
        $i++;
    }
    $totcurr = sprint($totcurr);
    $tot30 = sprint($tot30);
    $tot60 = sprint($tot60);
    $tot90 = sprint($tot90);
    $tot120 = sprint($tot120);
    $alltot = sprint($alltot);
    $printSupp .= "\n\t\t<tr><td><br></td></tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'><b>Totals</b></td>\n\t\t\t<td><b>" . CUR . " {$totcurr}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot30}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot60}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot90}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot120}</b></td>\n\t\t\t<td><b>" . CUR . " {$alltot}</b></td>\n\t\t</tr>\n\t\t<tr><td><br></td></tr>\n\t\t<tr>\n\t\t\t<td align='center' colspan='10'>\n\t\t\t\t<form action='../xls/cred-age-analysis-xls.php' method='POST' name='form'>\n\t\t\t\t\t<input type='submit' name='xls' value='Export to spreadsheet'>\n\t\t\t\t</form>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<p>\n\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t<tr><td><br></td></tr>\n\t\t<tr>\n\t\t\t<th>Quick Links</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='index-reports.php'>Financials</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='index-reports-debtcred.php'>Debtors & Creditors Reports</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../supp-new.php'>Add Supplier</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../supp-view.php'>View Suppliers</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../main.php'>Main Menu</a></td>\n\t\t</tr>\n\t</table>";
    return $printSupp;
}
function add_blindfold_333_consecutive_successes()
{
    global $lists, $WHERE;
    #--- Get ...
    $results = dbQuery("\n    SELECT personId, value1, value2, value3, value4, value5, year, month\n    FROM Results result, Competitions competition\n    {$WHERE} 1\n      AND eventId = '333bf'\n      AND competition.id = competitionId\n    ORDER BY personId, year, month, day, roundId\n  ");
    foreach (structureBy($results, 'personId') as $personResults) {
        extract($personResults[0]);
        #--- Collect all values of this person, add a 'current DNF' sentinel at the end.
        unset($datedValues);
        foreach ($personResults as $personResult) {
            foreach (range(1, 5) as $i) {
                $v = $personResult["value{$i}"];
                if ($v > 0 || $v == -1) {
                    $datedValues[] = array(getMonthName($personResult['month']) . " {$personResult['year']}", $v);
                }
            }
        }
        $datedValues[] = array('current', -1);
        #--- Find longest streak.
        $streak = array();
        $bestStreak = array();
        $streakFirstDate = "";
        $streakLastDate = "";
        foreach ($datedValues as $dv) {
            if ($dv[1] > 0) {
                if (!$streak) {
                    $streakFirstDate = $dv[0];
                }
                $streakLastDate = $dv[0];
                $streak[] = $dv[1];
            } else {
                if (count($streak) >= count($bestStreak)) {
                    $bestStreak = $streak;
                    $bestStreakFirstDate = $streakFirstDate;
                    $bestStreakLastDate = $dv[0] == 'current' ? '<b>ongoing...</b>' : $streakLastDate;
                }
                $streak = array();
            }
        }
        #--- This person doesn't have any streak? Next person, please.
        if (!$bestStreak) {
            continue;
        }
        #--- Determine properties of the streak.
        $length = count($bestStreak);
        $best = min($bestStreak);
        $worst = max($bestStreak);
        $average = array_sum($bestStreak) / $length;
        #--- Format and memorize this person with its streak
        $persons[] = array($personId, $length, '', '<span style="color:#0C0">' . formatValue($best) . '</span>', $average, '<span style="color:#E00">' . formatValue($worst) . '</span>', "{$bestStreakFirstDate} - {$bestStreakLastDate}");
    }
    usort($persons, 'compareBlindfoldStreaks');
    $persons = array_slice($persons, 0, 10);
    $lists[] = array("blind_streak_3x3", "Rubik's Cube Blindfolded longest success streak", "", "[P] Person [N] Length [t] &nbsp; [r] Best [r] Avg [r] Worst [t] When?", $persons);
}
コード例 #4
0
ファイル: recargar.php プロジェクト: javierlov/FuentesWeb
function setTitulo() {
	if ($_SESSION["tablero"]["periodo"] == "um") {
		$presupuesto = valorSql("SELECT cont.get_presupuestoactual FROM DUAL", "", array());
		$numero = valorSql("SELECT cont.get_ultimomespresupuesto(:presupuesto) FROM DUAL", "", array(":presupuesto" => $presupuesto));
		return "Último Mes (".getMonthName($numero).")";
	}
	if ($_SESSION["tablero"]["periodo"] == "t")
		return "Trimestre ".$_SESSION["tablero"]["trimestre"];
	if ($_SESSION["tablero"]["periodo"] == "m")
		return getMonthName($_SESSION["tablero"]["mes"]);
	if ($_SESSION["tablero"]["periodo"] == "a")
		return "Año";
}
コード例 #5
0
function view()
{
    # Just months
    $months = array("1", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    # Check if year has been opened
    core_connect();
    $sql = "SELECT * FROM active";
    $cRs = db_exec($sql) or errDie("Database Access Failed - check year open.", SELF);
    if (pg_numrows($cRs) > 0) {
        # Get the range
        core_connect();
        $sql = "SELECT * FROM range";
        $Rslt = db_exec($sql);
        if (pg_numrows($Rslt) < 1) {
            $OUTPUT = "<center><li class=err>ERROR : The Financial year Period range was not found on Database, Please make sure that everything is set during instalation.";
            require "template.php";
        }
        $range = Pg_fetch_array($Rslt);
        global $PRDMON, $MONPRD;
        $pmon = 0;
        $fyear = getFinYear() - (int) ($PRDMON[1] > 1);
        $prddesc = array();
        for ($i = 1; $i <= 12; $i++) {
            $mon = $PRDMON[$i];
            if ($mon < $pmon) {
                ++$fyear;
            }
            $pmon = $mon;
            if ($i == 1) {
                $smonth = getMonthName($mon) . " {$fyear}";
            } else {
                if ($i == 12) {
                    $endmon = getMonthName($mon) . " {$fyear}";
                }
            }
        }
        $prddesc = implode(" to ", $prddesc);
        $ret = "<p><p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><td colspan=2><li class=err>Financial year period range has already been set.</td></tr>\n\t\t\t<tr><th>Field</th><th>Value</th></tr>\n\t\t\t<tr class='bg-odd'><td>Financial Year Starts in</td><td align=center>{$smonth}</td></tr>\n\t\t\t<tr class='bg-even'><td>Financial Year Ends in</td><td align=center>{$endmon}</td></tr>\n\t\t</table>\n\t\t<p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr bgcolor='#88BBFF'><td><a href='../main.php'>Main Menu</a></td></tr>\n\t\t</table>";
        return $ret;
    }
    $month = 1;
    $smonth = "<select name=smonth>";
    while ($month <= 12) {
        $smonth .= "<option value='{$month}'>{$months[$month]}</option>";
        $month++;
    }
    $smonth .= "</select>";
    //layout
    $view = "\n\t<h3>Set Financial Year Period Range</h3>\n\t<form action='" . SELF . "' method=post name=form>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=300>\n\t\t<input type=hidden name=key value=confirm>\n\t\t<tr><th>Field</th><th>Value</th></tr>\n\t\t<tr class='bg-odd'><td>Financial Years Start in</td><td valign=center>{$smonth}</td></tr>\n\t\t<tr><td><br></td></tr>\n\t\t<tr><td><input type=button value='&laquo Back' onClick='javascript:history.back()'></td><td align=right><input type=submit value='Continue &raquo'></td></tr>\n\t</table>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</form>\n\t</table>";
    return $view;
}
コード例 #6
0
 public function actionTes()
 {
     // $emailbodydetail 	= array('emailbodydetail' => '$message');
     // $mail 				= new YiiMailer();
     // $mail->setView('template');
     // $mail->setFrom('*****@*****.**', 'hris');
     // $mail->setTo('*****@*****.**');
     // $mail->setData($emailbodydetail);
     // $mail->setSubject('Berita Acara Request');
     // $mail->send();
     $date_from_db = AttendancePresencesRecap::model()->find()->date;
     $date = strtotime($date_from_db);
     $date_indo = date('j', $date) . ' ' . getMonthName()[date('n', $date) - 1] . ' ' . date('Y', $date);
     echo $date_from_db . ' = ' . $date_indo;
 }
コード例 #7
0
ファイル: Module_Tribe.php プロジェクト: microlefes/Game
 function getContent($modus)
 {
     global $db_game, $params;
     $content = "";
     switch ($modus) {
         case 'tribe_history':
             $template = tmpl_open("modules/Module_Tribe/templates/history.ihtml");
             // Form Submitted
             if (isset($params->creator)) {
                 $something_wrong = false;
                 //TODO: $tribe has to be checked
                 $tribe = $params->historyTribe;
                 $day = intval($params->historyDay);
                 if ($day < 1 || $day > DAYS_PER_MONTH) {
                     $something_wrong = true;
                     $message = "Wrong day. Must be between 1 and " . DAYS_PER_MONTH . ".";
                 }
                 $year = intval($params->historyYear);
                 if ($year < STARTING_YEAR) {
                     $something_wrong = true;
                     $message = "Wrong year. Must be &gt;= " . STARTING_YEAR . ".";
                 }
                 $month = getMonthName($params->historyMonth);
                 $entry = $params->historyMessage;
                 if ($something_wrong) {
                     tmpl_set($template, "MESSAGE/message", $message);
                 } else {
                     $query = "INSERT INTO `TribeHistory` (`tribe`, `timestamp`, " . "`ingameTime`, `message`) VALUES ('{$tribe}', NULL , " . "'{$day}. {$month}<br>im Jahr {$year}', '{$entry}')";
                     if (!$db_game->query($query)) {
                         die("Error while inserting your entry!");
                     }
                     tmpl_set($template, "MESSAGE/message", "Entry inserted!");
                 }
             }
             // iterate months
             $months = array();
             for ($i = 1; $i <= MONTHS_PER_YEAR; ++$i) {
                 $months[] = array('text' => getMonthName($i), 'value' => $i);
             }
             if (sizeof($months)) {
                 tmpl_set($template, '/MONTH', $months);
             }
             $content = tmpl_parse($template);
             break;
     }
     return $content;
 }
コード例 #8
0
function defineAllLists()
{
    #----------------------------------------------------------------------
    #--- Compute some helpers.
    global $WHERE, $sinceDateHtml, $sinceDateMysql, $sinceDateCondition;
    $WHERE = "WHERE " . randomDebug() . " AND";
    list($year, $month, $day) = explode(' ', wcaDate("Y m d"));
    $year = intval($year) - 1;
    $month = intval($month);
    $day = intval($day);
    $monthName = getMonthName($month);
    $sinceDateHtml = "{$monthName} {$day}, {$year}";
    $sinceDateMysql = $year * 10000 + $month * 100 + $day;
    $sinceDateCondition = "(year*10000 + month*100 + day) >= {$sinceDateMysql}";
    #--- Import the list definitions.
    require 'includes/statistics/ALL_LISTS.php';
}
コード例 #9
0
ファイル: index - Copy.php プロジェクト: DinethH/EES
        //$dates[$count] = getMonthName(substr($row['date'],5,2)).", ".substr($row['date'],0,4);
        $dates[$count] = substr($row['date'], 0, 7);
    }
    $count++;
}
?>

<table>
<?php 
foreach ($dates as $date) {
    ?>

	<tr>
    	<td class="date_group">
    		<?php 
    echo getMonthName(substr($date, 5, 2)) . ", " . substr($date, 0, 4);
    ?>
        </td>
   
   		<td class="divider">
        </td>
        <td style="width:12px;">
        </td>
    
    	<td>
        	<span id="news_group">
           	<?php 
    $sql2 = mysql_query("SELECT * FROM _agriffith_news WHERE date LIKE '{$date}%' ORDER BY date");
    while ($row = mysql_fetch_array($sql2)) {
        echo "<li class='news_item'>" . $row['description'] . "</li>";
    }
コード例 #10
0
ファイル: imgtime.php プロジェクト: agatho/uaenhanced
<?php

require_once "include/time.inc.php";
require_once "include/basic.lib.php";
$now = getUgaAggaTime(time());
$time = $now['day'] . ". " . unhtmlentities(getMonthName($now['month'])) . ", " . $now['year'] . ". Jahr";
$timelen = strlen($time);
$size = 11;
if ($timelen > 18) {
    $size = 8;
}
$x = 95 - $timelen / 2 * $size;
if ($x < 0) {
    $x = 0;
}
$im_bg = @imagecreate(185, 32);
$im_fg = @imagecreate(185, 32);
$background_color = ImageColorAllocate($im_bg, 255, 255, 255);
$background_color = ImageColorAllocate($im_fg, 255, 255, 255);
$text_color = ImageColorAllocate($im_fg, 0, 0, 0);
ImageTTFText($im_fg, $size, 0, $x, 18, -$text_color, "aniron.ttf", $time);
imagecolortransparent($im_fg, $background_color);
imagecolortransparent($im_bg, $background_color);
imagecopy($im_bg, $im_fg, 0, 0, 0, 0, 185, 32);
header("Content-type: image/png");
ImagePNG($im_bg);
コード例 #11
0
function printAgeInv($_POST, $pure = TRUE)
{
    extract($_POST);
    # Set up table to display in
    global $PRDMON;
    $from = getMonthName($PRDMON[1]) . " " . getYearOfFinMon($PRDMON[1]);
    $to = getMonthName($PRDMON[12]) . " " . getYearOfFinMon($PRDMON[12]);
    $sel1 = "";
    $sel2 = "";
    $sel3 = "";
    if (isset($show_zero) and strlen($show_zero) > 0) {
        $sel1 = "checked='yes'";
    }
    if (isset($show_large) and strlen($show_large) > 0) {
        $sel2 = "checked='yes'";
    }
    if (isset($show_old) and strlen($show_old) > 0) {
        $sel3 = "checked='yes'";
    }
    if ($pure) {
        $show_filter = "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Filter/Sort Age Analysis</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='checkbox' name='show_zero' onClick='javascript:document.form1.submit();' value='yes' {$sel1}> Show Zero Balances</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='checkbox' name='show_large' onClick='javascript:document.form1.submit();' value='yes' {$sel2}> Show Largest Balances First</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='checkbox' name='show_old' onClick='javascript:document.form1.submit();' value='yes' {$sel3}> Show Oldest Balances First</td>\n\t\t\t\t</tr>\n\t\t\t\t" . TBL_BR . "\n\t\t\t</table>";
        $show_quicklinks = "\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t        " . TBL_BR . "\n\t\t        <tr>\n\t\t        \t<th>Quick Links</th>\n\t\t        </tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='index-reports.php'>Financials</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='index-reports-debtcred.php'>Debtors & Creditors Reports</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../customers-new.php'>Add Customer</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../customers-view.php'>View Customers</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../main.php'>Main Menu</a></td>\n\t\t\t\t</tr>\n\t\t\t</table>";
    } else {
        $show_filter = "";
        $show_quicklinks = "";
    }
    # Set up table to display in
    $printCust = "\n\t\t<h3>Debtors Age Analysis</h3>\n\t\t<h4>Period: {$from} to {$to}</h4>\n\t\t<form action='" . SELF . "' method='POST' name='form1'>\n\t\t{$show_filter}\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th><font size='1'>Acc no.</font></th>\n\t\t\t\t<th><font size='1'>Customer</font></th>\n\t\t\t\t<th><font size='1'>Sales Rep</font></th>\n\t\t\t\t<th><font size='1'>Contact Name</font></th>\n\t\t\t\t<th><font size='1'>Tel No.</font></th>\n\t\t\t\t<th><font size='1'>Current</font></th>\n\t\t\t\t<th><font size='1'>30 days</font></th>\n\t\t\t\t<th><font size='1'>60 days</font></th>\n\t\t\t\t<th><font size='1'>90 days</font></th>\n\t\t\t\t<th><font size='1'>120 days + </font></th>\n\t\t\t\t<th><font size='1'>Total Outstanding</font></th>\n\t\t\t</tr>";
    # Connect to database
    db_connect();
    # Query server
    $i = 0;
    $entries = array();
    $sql = "SELECT * FROM customers WHERE div = '" . USER_DIV . "' OR ddiv = '" . USER_DIV . "' ORDER BY accno ASC";
    $custRslt = db_exec($sql) or errDie("Unable to retrieve Customers from database.");
    if (pg_numrows($custRslt) < 1) {
        return "<li>There are no Customers in Cubit.</li>";
    }
    # Totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($cust = pg_fetch_array($custRslt)) {
        # Get all ages
        $to_month = date("m");
        $to_date = "now";
        $from_date = date("Y-m-d", mktime(0, 0, 0, date("m"), "01", date("Y")));
        $curr = cust_age($cust['cusnum'], 29, $cust['fcid'], $cust['location'], $to_month, $to_date, $from_date);
        $age30 = cust_age($cust['cusnum'], 59, $cust['fcid'], $cust['location'], $to_month, $to_date, $from_date);
        $age60 = cust_age($cust['cusnum'], 89, $cust['fcid'], $cust['location'], $to_month, $to_date, $from_date);
        $age90 = cust_age($cust['cusnum'], 119, $cust['fcid'], $cust['location'], $to_month, $to_date, $from_date);
        $age120 = cust_age($cust['cusnum'], 149, $cust['fcid'], $cust['location'], $to_month, $to_date, $from_date);
        # Customer total
        $custtot = sprint($curr + $age30 + $age60 + $age90 + $age120);
        db_con("exten");
        # sales rep
        $get_salsp = "SELECT salesp FROM salespeople WHERE salespid = '{$cust['sales_rep']}' LIMIT 1";
        $run_salsp = db_exec($get_salsp) or errDie("Unable to get sales person information.");
        if (pg_numrows($run_salsp) > 0) {
            $sarr = pg_fetch_array($run_salsp);
            $salesperson = $sarr['salesp'];
        } else {
            $salesperson = "";
        }
        $col1[] = $cust['accno'];
        $col2[] = $cust['surname'];
        $col22[] = $salesperson;
        $col3[] = $cust['contname'];
        $col4[] = $cust['bustel'];
        $col5[] = $curr;
        $col6[] = $age30;
        $col7[] = $age60;
        $col8[] = $age90;
        $col9[] = $age120;
        $col10[] = $custtot;
        $col11[] = $cust['cusnum'];
    }
    if (!isset($show_zero) or isset($show_zero) and strlen($show_zero) > 0) {
        #get key of zero entries
        foreach ($col10 as $each => $own) {
            if ($own == 0) {
                unset($col1[$each]);
                unset($col2[$each]);
                unset($col22[$each]);
                unset($col3[$each]);
                unset($col4[$each]);
                unset($col5[$each]);
                unset($col6[$each]);
                unset($col7[$each]);
                unset($col8[$each]);
                unset($col9[$each]);
                unset($col10[$each]);
            }
        }
    }
    if (isset($show_large) and strlen($show_large) > 0) {
        arsort($col10);
        $sortarr = $col10;
    }
    if (isset($show_old) and strlen($show_old) > 0) {
        arsort($col9);
        $sortarr = $col9;
        if (array_sum($sortarr) == 0) {
            arsort($col8);
            $sortarr = $col8;
            if (array_sum($sortarr) == 0) {
                arsort($col7);
                $sortarr = $col7;
                if (array_sum($sortarr) == 0) {
                    arsort($col6);
                    $sortarr = $col6;
                }
            }
        }
    }
    if (!isset($sortarr) or !is_array($sortarr)) {
        $sortarr = $col1;
    }
    $counter = 0;
    foreach ($sortarr as $key => $value) {
        if ($counter == 20 and $pure) {
            $printCust .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<th><font size='1'>Acc no.</font></th>\n\t\t\t\t\t<th><font size='1'>Customer</font></th>\n\t\t\t\t\t<th><font size='1'>Sales Rep</font></th>\n\t\t\t\t\t<th><font size='1'>Contact Name</font></th>\n\t\t\t\t\t<th><font size='1'>Tel No.</font></th>\n\t\t\t\t\t<th><font size='1'>Current</font></th>\n\t\t\t\t\t<th><font size='1'>30 days</font></th>\n\t\t\t\t\t<th><font size='1'>60 days</font></th>\n\t\t\t\t\t<th><font size='1'>90 days</font></th>\n\t\t\t\t\t<th><font size='1'>120 days + </font></th>\n\t\t\t\t\t<th><font size='1'>Total Outstanding</font></th>\n\t\t\t\t</tr>";
            $counter = 0;
        }
        $printCust .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td nowrap><font size='1'>{$col1[$key]}</font></td>\n\t\t\t\t<td nowrap><a href='#' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'><font size='1'>{$col2[$key]}</font></a></td>\n\t\t\t\t<td nowrap><font size='1'>{$col22[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1'>{$col3[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1'>{$col4[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col5[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col6[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col7[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col8[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col9[$key]}</font></td>\n\t\t\t\t<td nowrap><font size='1' onClick='popupSized(\"../cust-stmnt.php?cusnum={$col11[$key]}\",\"window1\",800,700)'>" . CUR . " {$col10[$key]}</font></td>\n\t\t\t</tr>";
        $counter++;
    }
    $totcurr = sprint(array_sum($col5));
    $tot30 = sprint(array_sum($col6));
    $tot60 = sprint(array_sum($col7));
    $tot90 = sprint(array_sum($col8));
    $tot120 = sprint(array_sum($col9));
    $alltot = sprint(array_sum($col10));
    $printCust .= "\n\t\t\t" . TBL_BR . "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'><font size='1'><b>Totals</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$totcurr}</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$tot30}</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$tot60}</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$tot90}</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$tot120}</b></font></td>\n\t\t\t\t<td nowrap><font size='1'><b>" . CUR . " {$alltot}</b></font></td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td align='center' colspan='10'>\n\t\t\t\t\t<form action='../xls/debt-age-analysis-xls.php' method='POST' name='form'>\n\t\t\t\t\t\t<input type='submit' name='xls' value='Export to spreadsheet'>\n\t\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t    {$show_quicklinks}";
    return $printCust;
}
コード例 #12
0
	<br>

	<p>
		Anda dapat melihat data pengajuan dengan mengunjungi aplikasi HRIS Mujigae melalui link di bawah ini.
	</p>

	<br>

	<p><a href="<?php 
echo $url;
?>
"><?php 
echo $url;
?>
</a></p>

	<p>Demikian kami sampaikan, untuk menjadi perhatian.</p>

	<br>

	<p>Bandung, <?php 
echo date('j') . ' ' . getMonthName()[date('n') - 1] . ' ' . date('Y');
?>
</p>

	<br>

	<p>Aplikasi HRIS Mujigae</p>
</body>
</html>
コード例 #13
0
                            $result12 = mysql_query("SELECT DATE_FORMAT(DateTimeOriginal,'%Y-%m-%d'), COUNT(*), pic_id, note, DateTimeOriginal, aktiv \n\t\t\t\t\t\t\tFROM {$table2} \n\t\t\t\t\t\t\tWHERE DateTimeOriginal LIKE '%" . $y . "-" . $m . "%' \n\t\t\t\t\t\t\tAND DateTimeOriginal <> '0000-00-00 00:00:00'\n\t\t\t\t\t\t\tAND aktiv = '1'\n\t\t\t\t\t\t\t{$restriction} \n\t\t\t\t\t\t\tAND {$stat}\n\t\t\t\t\t\t\tGROUP BY DATE_FORMAT(DateTimeOriginal,'%Y-%m-%d')\n\t\t\t\t\t\t\tORDER BY DATE_FORMAT(DateTimeOriginal,'%Y-%m-%d')");
                            $num12 = mysql_num_rows($result12);
                            //echo "Es wurden ".$num12." Tage gefunden.<BR>";
                            for ($i12 = '0'; $i12 < $num12; $i12++) {
                                $datum = substr(mysql_result($result12, $i12, 'DateTimeOriginal'), 0, 10);
                                $T = date('d', strtotime($datum));
                                $aufn_dat = date('d.m.Y', strtotime($datum));
                                $aufn_DAT = date('Y-m-d', strtotime($datum));
                                //Ermittlung der an diesem Tag gemachten Bilder:
                                $anz12 = mysql_result($result12, $i12, COUNT('*'));
                                echo "<TR id='kat'>\n\t\t\t\t\t\t\t\t<TD id='kat1'> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<SPAN style='margin-left:2px;'>" . $aufn_dat . "</span></TD>";
                                echo "\n\t\t\t\t\t\t\t\t<TD id='kat2'><SPAN style='cursor:pointer;' onClick='getTimePreview2(\"{$jahr}\",\"{$month_number}\",\"{$T}\",0,\"{$mod}\",\"{$modus}\",\"{$base_file}\",\"{$sr}\")'>" . $sel_one . "</span></TD>\n\t\t\t\t\t\t\t\t<TD id='kat2'><SPAN style='cursor:pointer;' onClick='getTimePreview2(\"{$jahr}\",\"{$month_number}\",\"{$T}\",1,\"{$mod}\",\"{$modus}\",\"{$base_file}\",\"{$sr}\")'>" . $sel_all . "</span></TD>\n\t\t\t\t\t\t\t\t<TD id='kat2'>" . $anz12 . "</TD>\n\t\t\t\t\t\t\t\t</TR>";
                            }
                        } else {
                            $s_m = $jahr . "_" . $month_number;
                            echo "<SPAN style='cursor:pointer;' onClick='location.href=\"getTimeTreeview2.php?pic_id={$pic_id}&mod={$mod}&show_mod={$s_m}\"'>" . getMonthName($month_number) . "</SPAN>\n\t\t\t\t\t\t\t</TD>\n\t\t\t\t\t\t\t<TD id='kat2'>\n\t\t\t\t\t\t\t<SPAN style='cursor:pointer;' onClick='getTimePreview2(\"{$jahr}\",\"{$month_number}\",0,0,\"{$mod}\",\"{$modus}\",\"{$base_file}\")'>\n\t\t\t\t\t\t\t<img src='../../share/images/ok.gif' width='15' height='15' title='Bilder anzeigen' />\n\t\t\t\t\t\t\t</SPAN>\n\t\t\t\t\t\t\t</TD>\n\t\t\t\t\t\t\t<TD id='kat2'>" . $num5 . "</TD></TR>";
                        }
                    }
                }
            }
        }
    }
}
//Ermittlung der Bilder, welche noch keinem Datum zugeordnet wurden:
$modus = 'zeit';
$result7 = mysql_query("SELECT DateTimeOriginal, note, pic_id, aktiv \nFROM {$table2} \nWHERE DateTimeOriginal = '0000-00-00 00:00:00'\nAND aktiv = '1'\n{$restriction} \nAND {$stat}");
@($num7 = mysql_num_rows($result7));
if ($num7 == '') {
    $num7 = 0;
}
echo "<TR id='kat'>\n<TD id='kat1'>Sonstige Bilder</TD>\n<TD id='kat2'></TD>\n<TD id='kat2'></TD>\n</TR>\n<TR id='kat'>\n<TD id='kat1' style=' background-color:#ff9900;'><SPAN style='margin-left:22px'>Bilder ohne Datumsangabe</SPAN></TD>\n<TD id='kat2'><SPAN style='cursor:pointer;' onClick='getTimePreview2(0000,0,0,0,\"{$mod}\",\"{$modus}\",\"{$base_file}\")' title='Bilder anzeigen'>" . $sel_one . "</SPAN></TD>\n<TD id='kat2'><SPAN style='cursor:pointer;' onClick='getTimePreview2(0000,0,0,1,\"{$mod}\",\"{$modus}\",\"{$base_file}\")' title='Bilder anzeigen'>" . $sel_all . "</SPAN></TD>\n<TD id='kat2'>" . $num7 . "</TD>\n</TR>\n</TABLE>";
コード例 #14
0
function slip($_POST, $pure = false)
{
    # get vars
    extract($_POST);
    $empnum += 0;
    # validate input
    require_lib("validate");
    $v = new validate();
    if (isset($from_day)) {
        $v->isOk($from_day, "num", 1, 2, "Invalid from Date day.");
        $v->isOk($from_month, "num", 1, 2, "Invalid from Date month.");
        $v->isOk($from_year, "num", 1, 4, "Invalid from Date Year.");
        $v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
        $v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
        $v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
        # mix dates
        $fromdate = $from_year . "-" . $from_month . "-" . $from_day;
        $todate = $to_year . "-" . $to_month . "-" . $to_day;
        if (!checkdate($from_month, $from_day, $from_year)) {
            $v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
        }
        if (!checkdate($to_month, $to_day, $to_year)) {
            $v->isOk($todate, "num", 1, 1, "Invalid to date.");
        }
    } else {
        if (isset($mon)) {
            $v->isOk($mon, "num", 1, 2, "Invalid month selected.");
        }
    }
    $v->isOk($empnum, "num", 1, 14, "Invalid employee selected.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirmCust .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    #check what we have permission to
    $get_perm = "SELECT payroll_groups FROM users WHERE username = '******'USER_NAME']}' LIMIT 1";
    $run_perm = db_exec($get_perm) or errDie("Unable to get payroll groups permission information.");
    if (pg_numrows($run_perm) > 0) {
        $parr = pg_fetch_array($run_perm);
        if (strlen($parr['payroll_groups']) > 0) {
            $pay_grps = explode(",", $parr['payroll_groups']);
        } else {
            $pay_grps = array();
        }
    } else {
        $pay_grps = array();
    }
    if (isset($emp_group) and is_array($emp_group)) {
        $emp_groups = array();
        $emps = array();
        foreach ($emp_group as $each) {
            if (!in_array($each, $pay_grps)) {
                continue;
            }
            $emp_groups[] = $each;
            $get_emp = "SELECT empnum FROM employees WHERE emp_group = '{$each}'";
            $run_emp = db_exec($get_emp) or errDie("Unable to get employees information.");
            if (pg_numrows($run_emp) > 0) {
                while ($earr = pg_fetch_array($run_emp)) {
                    $emps[] = $earr['empnum'];
                }
            }
        }
    } else {
        #check for which groups we have perm
        $get_check = "SELECT payroll_groups FROM users WHERE username = '******'USER_NAME']}' LIMIT 1";
        $run_check = db_exec($get_check) or errDie("Unable to get employees group permissions.");
        if (pg_numrows($run_check) > 0) {
            $earr = pg_fetch_array($run_check);
            if (strlen($earr['payroll_groups']) > 0) {
                $eperms = explode(",", $earr['payroll_groups']);
                $egsearch = " AND (emp_group = '" . implode("' OR emp_group = '", $eperms) . "')";
            } else {
                $egsearch = "AND FALSE";
            }
        }
        $emp_groups[] = array(0 => '0');
        $get_emp = "SELECT empnum FROM employees WHERE true {$egsearch}";
        $run_emp = db_exec($get_emp) or errDie("Unable to get employees information.");
        while ($earr = pg_fetch_array($run_emp)) {
            $emps[] = $earr['empnum'];
        }
    }
    if (!isset($emps)) {
        $emps = array(0);
    }
    if (in_array('0', $emp_groups)) {
        $show_all = TRUE;
    } else {
        $show_all = FALSE;
    }
    $totgross = 0;
    $totcomm = 0;
    $totins = 0;
    $totuif = 0;
    $totpaye = 0;
    $totded = 0;
    $totsal = 0;
    if (!isset($salyear) or strlen($salyear) < 1) {
        $salyear = EMP_YEAR;
    }
    /* get employee details */
    db_connect();
    if (isset($from_day)) {
        $retfunc = "slctDate";
        if ($empnum != "0") {
            #if not all then use selected employee
            $empw = "empnum='{$empnum}' AND ";
        } else {
            #else use all payslips ... but only with emps in selected group
            if (!$show_all) {
                $empw = "";
                foreach ($emps as $each) {
                    $empw .= "empnum='{$each}' OR ";
                }
                $empw .= "empnum='{$each}'";
            }
        }
        if (substr($empw, -4) == "AND ") {
            $empw = substr($empw, 0, -4);
        }
        if (!isset($empw)) {
            $empw = "true";
        }
        $sql = "SELECT 'salp' AS paytype, * FROM salpaid\n\t\t\t\tWHERE ({$empw}) AND saldate >= '{$fromdate}' AND saldate <= '{$todate}' AND div = '" . USER_DIV . "' AND cyear='{$salyear}'\n\t\t\t\tUNION\n\t\t\t\tSELECT 'salr' AS paytype, * FROM salr\n\t\t\t\tWHERE ({$empw}) AND saldate >= '{$fromdate}' AND saldate <= '{$todate}' AND div = '" . USER_DIV . "' AND cyear='{$salyear}'\n\t\t\t\tORDER BY true_ids ASC";
    } else {
        if (isset($empnum)) {
            $retfunc = "slctEmployee";
            $sql = "SELECT 'salp' AS paytype, * FROM salpaid\n\t\t\t\tWHERE month='{$mon}' AND empnum='{$empnum}' AND div = '" . USER_DIV . "' AND cyear='{$salyear}'\n\t\t\t\tUNION\n\t\t\t\tSELECT 'salr' AS paytype, * FROM salr\n\t\t\t\tWHERE month='{$mon}' AND empnum='{$empnum}' AND div = '" . USER_DIV . "' AND cyear='{$salyear}'\n\t\t\t\tORDER BY true_ids ASC";
        } else {
            invalid_use();
        }
    }
    $pRslt = db_exec($sql) or errDie("Unable to select employee payments from database.");
    if (pg_numrows($pRslt) < 1) {
        return "<li class='err'> - Employee salaries matching the search criteria not found.</li>" . $retfunc();
    }
    $slip = "";
    if (pg_numrows($pRslt) > 0) {
        $empdata = array();
        $empcounter = array();
        while ($pay = pg_fetch_array($pRslt)) {
            $en = $pay["empnum"];
            $mwid = "{$pay['month']}:{$pay['week']}";
            if (!isset($empdata[$en])) {
                $empdata[$en] = array();
            }
            if (!isset($empdata[$en][$mwid])) {
                $empdata[$en][$mwid] = array("gross" => 0, "comm" => 0, "loanins" => 0, "uif" => 0, "paye" => 0, "salary" => 0, "saldate" => "", "payslip" => 0);
            }
            $ed =& $empdata[$en][$mwid];
            $gross = $pay['salary'] - $pay['totallow'] - $pay['comm'] + $pay['totded'] + $pay['uif'] + $pay['paye'] + $pay['loanins'];
            $ed["saldate"] = $pay["saldate"];
            if ($pay["paytype"] == "salp") {
                $ed["gross"] += $gross;
                $ed["comm"] += $pay["comm"];
                $ed["loanins"] += $pay["loanins"];
                $ed["uif"] += $pay["uif"];
                $ed["paye"] += $pay["paye"];
                // 				$ed["totded"] += $pay["totded"];
                $ed["salary"] += $pay["salary"];
                $ed["payslip"] = $pay["id"];
                $totgross += $gross;
                $totcomm += $pay['comm'];
                $totins += $pay['loanins'];
                $totuif += $pay['uif'];
                $totpaye += $pay['paye'];
                $totded += $pay['totded'];
                $totsal += $pay['salary'];
            } else {
                $ed["gross"] -= $gross;
                $ed["comm"] -= $pay["comm"];
                $ed["loanins"] -= $pay["loanins"];
                $ed["uif"] -= $pay["uif"];
                $ed["paye"] -= $pay["paye"];
                // 				$ed["totded"] -= $pay["totded"];
                $ed["salary"] -= $pay["salary"];
                $ed["payslip"] = "{$pay['id']}&rev=true";
                $totgross -= $gross;
                $totcomm -= $pay['comm'];
                $totins -= $pay['loanins'];
                $totuif -= $pay['uif'];
                $totpaye -= $pay['paye'];
                $totded -= $pay['totded'];
                $totsal -= $pay['salary'];
            }
            $get_deds = "SELECT distinct(type) FROM emp_ded WHERE payslip = '{$pay['id']}'";
            $run_deds = db_exec($get_deds) or errDie("Unable to get salary deduction information.");
            if (pg_numrows($run_deds) > 0) {
                // 				$deductions = "";
                // 				$ed["totded"] = array()
                $colspan = 0;
                while ($darr = pg_fetch_array($run_deds)) {
                    $darr['type'] += 0;
                    if ($darr['type'] > 0) {
                        print "adding a deduction<br>";
                        $get_amt = "SELECT amount, description FROM emp_ded WHERE payslip = '{$pay['id']}' AND type = '{$darr['type']}' LIMIT 1";
                        $run_amt = db_exec($get_amt) or errDie("Unable to get employee deduction amount.");
                        $deduction_heading .= "<th>" . pg_fetch_result($run_amt, 0, 1) . "</th>";
                        $ed["totded"][] = "<td nowrap>" . CUR . " " . sprint(pg_fetch_result($run_amt, 0, 0)) . "</td>";
                        // 						$deductions .= "<td nowrap>".CUR." ".sprint($darr['amount'])."</td>";
                        $colspan++;
                    }
                }
            } else {
                // 				$deductions = "";
                $colspan = 1;
            }
        }
        print "----------<br>";
        print "<pre>";
        var_dump($ed);
        print "</pre>";
        print "<br>>>>>>>>>>>>>>>>>>>>><br>";
        // print "<pre>";
        // var_dump ($
        foreach ($empdata as $empnum => $months) {
            foreach ($months as $monthweek => $sal) {
                list($month, $week) = explode(":", $monthweek);
                if (($emp = qryEmployee($empnum, "fnames, sname, basic_sal, payprd")) === false) {
                    $emp = qryLEmployee($empnum, "fnames, sname, basic_sal, payprd");
                }
                // not a date range but a single employee, store the name
                if (!isset($from_day)) {
                    $empname = "{$emp['fnames']} {$emp['sname']}";
                }
                /* create month week description */
                $mw_desc = getMonthName($month);
                // weekly
                if ($emp["payprd"] == "w") {
                    $mw_desc .= ", Week {$week}";
                    // fortnightly
                } else {
                    if ($emp["payprd"] == "f") {
                        if ($week == 1) {
                            $week = "1-2";
                        } else {
                            if ($week == 2) {
                                $week = "3-4";
                            } else {
                                $week = "5";
                            }
                        }
                        $mw_desc .= ", Week {$week}";
                    }
                }
                print "<pre>";
                var_dump($sal["totded"]);
                print "</pre>";
                $bgColor = bgcolorg();
                $slip .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$emp['fnames']} {$emp['sname']}</td>\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["gross"]) . "</td>\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["comm"]) . "</td>\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["loanins"]) . "</td>\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["uif"]) . "</td>\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["paye"]) . "</td>\n\t\t\t\t\t\t" . implode("", $sal["totded"]) . "\n\t\t\t\t\t\t<td nowrap>" . CUR . " " . sprint($sal["salary"]) . "</td>\n\t\t\t\t\t\t<td nowrap>{$mw_desc}</td>\n\t\t\t\t\t\t<td nowrap>{$sal['saldate']}</td>";
                if (!$pure) {
                    $slip .= "\n\t\t\t\t\t\t<td><a href='payslip-view.php?empnum={$empnum}&id={$sal['payslip']}'>View</a></td>\n\t\t\t\t\t\t<td><a target='_blank' href='payslip-print.php?id={$sal['payslip']}'>Print</a></td>";
                }
                $slip .= "</tr>";
            }
        }
        # Format the totals
        $totgross = sprint($totgross);
        $totcomm = sprint($totcomm);
        $totins = sprint($totins);
        $totuif = sprint($totuif);
        $totpaye = sprint($totpaye);
        $totded = sprint($totded);
        $totsal = sprint($totsal);
        $slip .= "\n\t\t\t<tr class='bg-even'>\n\t\t\t\t<td><b>Total</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totgross}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totcomm}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totins}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totuif}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totpaye}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totded}</b></td>\n\t\t\t\t<td nowrap><b>" . CUR . " {$totsal}</b></td>\n\t\t\t\t<td colspan='4'></td>\n\t\t\t</tr>";
    } else {
        return "<li> - There are no salary payments for the selected month</li>";
    }
    if (isset($from_day)) {
        $title = "<h3>Salaries Paid {$fromdate} TO {$todate}</h3>";
    } else {
        $title = "<h3>Salaries for {$empname}</h3>";
    }
    $slip = "\n\t\t<center>\n\t\t{$title}\n\t\t<table " . TMPL_tblDflts . " width='70%'>\n\t\t\t<tr>\n\t\t\t\t<th>Employee</th>\n\t\t\t\t<th>Gross Salary</th>\n\t\t\t\t<th>Commission</th>\n\t\t\t\t<th>Low or interest free loan</th>\n\t\t\t\t<th>UIF</th>\n\t\t\t\t<th>PAYE</th>\n\t\t\t\t<th colspan='{$colspan}'>Deductions</th>\n\t\t\t\t<th>Nett Income</th>\n\t\t\t\t<th>Month/Week</th>\n\t\t\t\t<th>Payment Date</th>\n\t\t\t\t" . (!$pure ? "<th colspan='2'>Options</th>" : "") . "\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='6'></th>\n\t\t\t\t{$deduction_heading}\n\t\t\t\t<th colspan='5'></th>\n\t\t\t</tr>\n\t\t\t{$slip}\n\t\t\t" . TBL_BR;
    if (!$pure) {
        $slip .= "\n\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t" . array2form($_REQUEST) . "\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='2'><input name=key type=submit value='Export to Spreadsheet'></td>\n\t\t\t\t</tr>\n\t\t\t</form>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee")) . "\n\t\t\t</td></tR>";
    }
    $slip .= "\n\t\t</table>\n\t\t</center>";
    return $slip;
}
コード例 #15
0
function display($_POST)
{
    extract($_POST);
    $prev_yr_schema = substr(YR_DB, 0, 2) . (substr(YR_DB, 2) - 1);
    if ($prev_yr_schema < 0) {
        return "<li class='err'>No prior years found.</li>";
    }
    /* "prior" should be from beginning of month (iow the end of the previous)
    		or if it is the first period the end of period 0 (end of last year)  */
    global $MONPRD, $PRDMON;
    $month_from = $PRDMON[$MONPRD[$month_from] - 1];
    switch (strtolower($key)) {
        case "print":
        case "save":
        case "export to spreadsheet":
            $print_func = true;
            break;
        default:
            $print_func = false;
            break;
    }
    // Retrieve the accounts list from Cubit
    db_conn("cubit");
    $sql = "SELECT * FROM saved_cf_accounts";
    $cfacc_rslt = db_exec($sql) or errDie("Unable to retrieve accounts list from Cubit.");
    $i = 0;
    while ($cfacc_data = pg_fetch_array($cfacc_rslt)) {
        // Multidimensional array, variable variable
        ${$cfacc_data["category"]}[] = $cfacc_data["accid"];
    }
    $cat_list = array("nciis" => "Non Cash Item in Income Statement", "ciaal" => "Change in Assets and Liabilities", "cffuif" => "Cash Flows From / Used in Financing", "cffuii" => "Cash Flows From / Used in Investing");
    $cat_total = array("ciaal" => "Net cash provided by operating activities", "cffuif" => "Net cash provided by financing activities", "cffuii" => "Net cash used in investing activities");
    // Net cash and cash equivalents, beginning of period
    $cash_equiv_bop = array();
    $cash_equiv_bop["curr_total"] = 0;
    $cash_equiv_bop["prev_total"] = 0;
    $cash_equiv_bop["var_total"] = 0;
    $cash_equiv_bop["percvar_total"] = 0;
    foreach ($cat_list as $key => $value) {
        if (($key == "cffuif" || $key == "cffuii") && isset(${"acc_{$key}"})) {
            foreach (${"acc_{$key}"} as $accid) {
                db_conn("core");
                $sql = "SELECT * FROM trial_bal_actual WHERE accid='{$accid}' AND month='{$month_from}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve trial balance data from Cubit.");
                $py_data = pg_fetch_array($rslt);
                $sql = "SELECT * FROM trial_bal_actual WHERE accid='{$accid}' AND month='{$month_to}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve trial balance data from Cubit.");
                $tb_data = pg_fetch_array($rslt);
                /*if ($prev_yr_schema) {
                			db_conn($prev_yr_schema);
                			$sql = "SELECT * FROM year_balance WHERE accid='$accid'";
                			$rslt = db_exec($sql) or errDie("Unable to retrieve previous year data from Cubit.");
                			$py_data = pg_fetch_array($rslt);
                		} else {
                			$py_data = array(
                				"debit" => 0,
                				"credit" => 0
                			);
                		}*/
                db_conn("core");
                $sql = "SELECT toptype FROM accounts WHERE accid='{$accid}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve accounts from Cubit.");
                $toptype = pg_fetch_result($rslt, 0);
                $cash_equiv_bop["curr_total"] += calculate($toptype, $tb_data["debit"], $tb_data["credit"]);
                $cash_equiv_bop["prev_total"] += calculate($toptype, $py_data["debit"], $py_data["credit"]);
            }
        }
    }
    $cash_equiv_bop["var_total"] = $cash_equiv_bop["curr_total"] - $cash_equiv_bop["prev_total"];
    if ($cash_equiv_bop["curr_total"] && $cash_equiv_bop["prev_total"]) {
        $cash_equiv_bop["percvar_total"] = $cash_equiv_bop["curr_total"] / $cash_equiv_bop["prev_total"] * 100;
    } else {
        $cash_equiv_bop["percvar_total"] = 0;
    }
    // Net cash and cash equivalents, end of period
    $cash_equiv_eop = array();
    $cash_equiv_eop["curr_total"] = 0;
    $cash_equiv_eop["prev_total"] = 0;
    $cash_equiv_eop["var_total"] = 0;
    $cash_equiv_eop["percvar_total"] = 0;
    foreach ($cat_list as $key => $value) {
        if (($key == "cffuif" || $key == "cffuii") && isset(${"acc_{$key}"})) {
            foreach (${"acc_{$key}"} as $accid) {
                db_conn("core");
                $sql = "SELECT * FROM trial_bal_actual WHERE accid='{$accid}' AND month='{$month_from}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve trial balance data from Cubit.");
                $py_data = pg_fetch_array($rslt);
                $sql = "SELECT * FROM trial_bal_actual WHERE accid='{$accid}' AND month='{$month_to}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve trial balance data from Cubit.");
                $tb_data = pg_fetch_array($rslt);
                /*$py_month = strtolower(getMonthName($month_to));
                		db_conn($prev_yr_schema);
                		$sql = "SELECT * FROM $py_month WHERE accid='$accid'";
                		$rslt = db_exec($sql) or errDie("Unable to retrieve previous year data from Cubit.");
                		$py_data = pg_fetch_array($rslt);*/
                db_conn("core");
                $sql = "SELECT toptype FROM accounts WHERE accid='{$accid}'";
                $rslt = db_exec($sql) or errDie("Unable to retrieve accounts from Cubit.");
                $toptype = pg_fetch_result($rslt, 0);
                $cash_equiv_eop["curr_total"] += calculate($toptype, $tb_data["debit"], $tb_data["credit"]);
                $cash_equiv_eop["prev_total"] += calculate($toptype, $py_data["debit"], $py_data["credit"]);
            }
        }
    }
    $cash_equiv_eop["var_total"] = $cash_equiv_eop["curr_total"] - $cash_equiv_eop["prev_total"];
    if ($cash_equiv_eop["curr_total"] && $cash_equiv_eop["prev_total"]) {
        $cash_equiv_eop["percvar_total"] = $cash_equiv_eop["curr_total"] / $cash_equiv_eop["prev_total"] * 100;
    } else {
        $cash_equiv_eop["percvar_total"] = 0;
    }
    // Output the headings and accounts
    $acc_out = "";
    if (!pg_num_rows($cfacc_rslt)) {
        $acc_out .= "<tr class='bg-odd'><td colspan='5'>No accounts selected.</td></tr>";
    }
    $i = 0;
    foreach ($cat_list as $key => $value) {
        if (isset(${$key})) {
            // Category heading
            $acc_out .= "<tr><th colspan='5' class='cashflow_cats'>{$value}</th></tr>";
            foreach (${"acc_{$key}"} as $accid) {
                // Retrieve the account info from the trial balance
                db_conn("core");
                $sql = "SELECT debit, credit FROM trial_bal WHERE accid='{$accid}' AND month='{$month_from}'";
                $tb_rslt = db_exec($sql) or errDie("Unable to retrieve account information from Cubit.");
                $ptb_data = pg_fetch_array($tb_rslt);
                $sql = "SELECT debit, credit FROM trial_bal WHERE accid='{$accid}' AND month='{$month_to}'";
                $tb_rslt = db_exec($sql) or errDie("Unable to retrieve account information from Cubit.");
                $tb_data = pg_fetch_array($tb_rslt);
                // Account information
                db_conn("core");
                $sql = "SELECT * FROM accounts WHERE accid='{$accid}'";
                $acc_rslt = db_exec($sql) or errDie("Unable to retrieve account information from Cubit.");
                $acc_data = pg_fetch_array($acc_rslt);
                // Retrieve previous year trial balance
                /*db_conn($prev_yr_schema);
                				$sql = "SELECT * FROM year_balance WHERE accid='$accid'";
                				$ptb_rslt = db_exec($sql) or errDie("Unable to retrieve previous year account information from Cubit.");
                				$ptb_data = pg_fetch_array($ptb_rslt);
                
                				// Previous year account information
                				db_conn("core");
                				$sql = "SELECT * FROM accounts WHERE accid='$accid'";
                				$pacc_rslt = db_exec($sql) or errDie("Unable to retrieve previous year account information from Cubit.");
                				$pacc_data = pg_fetch_array($pacc_rslt);*/
                // Make sure we've got a toptype
                if (empty($acc_data["toptype"])) {
                    if ($acc_data["acctype"] == "I") {
                        $acc_data["toptype"] = "other_income";
                    }
                    if ($acc_data["acctype"] == "E") {
                        $acc_data["toptype"] = "expenses";
                    }
                }
                /*if (empty($pacc_data["toptype"])) {
                			if ($pacc_data["acctype"] == "I") $pacc_data["toptype"] = "other_income";
                			if ($pacc_data["acctype"] == "E") $pacc_data["toptype"] = "expenses";
                		}*/
                // Do the calculations
                $current = calculate($acc_data["toptype"], $tb_data["debit"], $tb_data["credit"]);
                $prior = calculate($acc_data["toptype"], $ptb_data["debit"], $ptb_data["credit"]);
                $variance = $current - $prior;
                // We don't want a division by zero...
                if ($current && $prior) {
                    $percvar = $current / $prior * 100;
                } else {
                    $percvar = "0.00";
                }
                // How should the current category be displayed
                switch ($key) {
                    case "ciaal":
                        if ($current <= $prior) {
                            $decrease = "(decrease)";
                            $increase = "Increase";
                        } else {
                            $decrease = "decrease";
                            $increase = "(Increase)";
                        }
                        $acc_out .= "<tr class='bg-even'>\n\t\t\t\t\t\t\t<td>{$increase} {$decrease} in {$acc_data['accname']}</td>\n\t\t\t\t\t\t\t<td align='right'><b>" . sprint($current) . "</b></td>\n\t\t\t\t\t\t\t<td align='right'>" . sprint($prior) . "</td>\n\t\t\t\t\t\t\t<td align='right'>" . sprint($variance) . "</td>\n\t\t\t\t\t\t\t<td align='right'><b>" . sprint($percvar) . "</td>\n\t\t\t\t\t\t</tr>";
                        break;
                    case "nciis":
                    case "cffuif":
                    case "cffuii":
                        $acc_out .= "<tr class='bg-even'>\n\t\t\t\t\t\t\t<td>{$acc_data['accname']}</td>\n\t\t\t\t\t\t\t<td align='right'><b>" . sprint($current) . "</b></td>\n\t\t\t\t\t\t\t<td align='right'>" . sprint($prior) . "</td>\n\t\t\t\t\t\t\t<td align='right'>" . sprint($variance) . "</td>\n\t\t\t\t\t\t\t<td align='right'><b>" . sprint($percvar) . "</td>\n\t\t\t\t\t\t</tr>";
                }
                // Create the total variables, unless they already exist
                if (!isset(${$key}["curr_total"])) {
                    ${$key}["curr_total"] = 0.0;
                }
                if (!isset(${$key}["prev_total"])) {
                    ${$key}["prev_total"] = 0.0;
                }
                if (!isset(${$key}["var_total"])) {
                    ${$key}["var_total"] = 0.0;
                }
                if (!isset(${$key}["percvar_total"])) {
                    ${$key}["percvar_total"] = 0.0;
                }
                // Assign values to the totals
                if (isset(${$key})) {
                    ${$key}["curr_total"] += $current;
                    ${$key}["prev_total"] += $prior;
                    ${$key}["var_total"] += $variance;
                    ${$key}["percvar_total"] += $percvar;
                }
            }
            if ($key == "ciaal") {
                $acc_out .= "<tr class='bg-odd'>\n\t\t\t\t\t<td>Total adjustments</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["curr_total"]) . "</b></td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["prev_total"]) . "</td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["var_total"]) . "</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["percvar_total"]) . "</b></td>\n\t\t\t\t</tr>";
            }
            // nciis and ciaal are both in the same category, dont assign a total to both
            // instead just use nciis
            if ($key != "nciis") {
                if (isset($nciis) && isset($ciaal)) {
                    $ciaal["curr_total"] += $nciis["curr_total"];
                    $ciaal["prev_total"] += $nciis["prev_total"];
                    $ciaal["var_total"] += $nciis["var_total"];
                    $ciaal["percvar_total"] += $nciis["percvar_total"];
                }
                // Totals output
                $acc_out .= "<tr class='bg-odd'>\n\t\t\t\t\t<td>{$cat_total[$key]}</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["curr_total"]) . "</b></td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["prev_total"]) . "</td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["var_total"]) . "</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["percvar_total"]) . "</b></td>\n\t\t\t\t</tr>";
            } else {
                // Totals output
                $acc_out .= "<tr class='bg-odd'>\n\t\t\t\t\t<td>&nbsp</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["curr_total"]) . "</b></td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["prev_total"]) . "</td>\n\t\t\t\t\t<td align='right'>" . sprint(${$key}["var_total"]) . "</td>\n\t\t\t\t\t<td align='right'><b>" . sprint(${$key}["percvar_total"]) . "</b></td>\n\t\t\t\t</tr>";
            }
        }
    }
    // Net cash and cash equivalents
    if (!isset($cffuif)) {
        $cffuif = array();
        $cffuif["curr_total"] = 0.0;
        $cffuif["prev_total"] = 0.0;
        $cffuif["var_total"] = 0.0;
        $cffuif["percvar_total"] = 0.0;
    }
    if (!isset($cffuii)) {
        $cffuii = array();
        $cffuii["curr_total"] = 0.0;
        $cffuii["prev_total"] = 0.0;
        $cffuii["var_total"] = 0.0;
        $cffuii["percvar_total"] = 0.0;
    }
    $cash_equiv = array();
    $cash_equiv["curr_total"] = $cffuif["curr_total"] + $cffuii["curr_total"] + $nciis["curr_total"];
    $cash_equiv["prev_total"] = $cffuif["prev_total"] + $cffuii["prev_total"] + $nciis["prev_total"];
    $cash_equiv["var_total"] = $cffuif["var_total"] + $cffuii["var_total"] + $nciis["var_total"];
    $cash_equiv["percvar_total"] = $cffuif["percvar_total"] + $cffuii["percvar_total"] + $nciis["percvar_total"];
    if ($cash_equiv["curr_total"] < $cash_equiv["prev_total"]) {
        $cash_equiv["inc_dec"] = "(increase) decrease";
    } else {
        $cash_equiv["inc_dec"] = "increase (decrease)";
    }
    // Date range
    // Retrieve the current year from Cubit
    db_conn("core");
    $sql = "SELECT yrname FROM active";
    $rslt = db_exec($sql) or errDie("Unable to retrieve current year from Cubit.");
    $year_out = substr(pg_fetch_result($rslt, 0), 1);
    $month_from_out = getMonthName($month_from);
    $month_to_out = getMonthName($month_to);
    if ($month_from == $month_to) {
        $date_range = "{$month_from_out} {$year_out}";
    } else {
        $date_range = "{$month_from_out} TO {$month_to_out} {$year_out}";
    }
    $OUTPUT = "";
    if (!$print_func) {
        $OUTPUT .= "\n\t\t<form method='post' action='" . SELF . "'>\n\t\t<input type='hidden' name='key' value='slct'>\n\t\t<input type='hidden' name='month_from' value='{$month_from}'>\n\t\t<input type='hidden' name='month_to' value='{$month_to}'>";
    }
    $OUTPUT .= "\n\t<table border='0' cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='100%'>\n\t\t<tr>\n\t\t\t<td><h3>Statement of Cash Flow</h3></td>\n\t\t\t<td align='right'><h3>{$date_range}</h3></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2' class='err'>\n\t\t\tThe non-cash items have been adjusted to operating profit. The other\n\t\t\tleg must still be debited or credited to an asset/liability account.\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n\t\t<tr>\n\t\t\t<th>&nbsp;</td>\n\t\t\t<th width='10%' class='thkborder'>Current</th>\n\t\t\t<th width='10%' class='thkborder'>Prior</th>\n\t\t\t<th width='10%' class='thkborder'>Variance</th>\n\t\t\t<th width='10%' class='thkborder thkborder_right'>%Var</th>\n\t\t</tr>\n\t\t{$acc_out}\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Net cash {$cash_equiv['inc_dec']} in cash and cash equivalents</td>\n\t\t\t<td align='right'><b>" . sprint($cash_equiv["curr_total"]) . "</b></td>\n\t\t\t<td align='right'>" . sprint($cash_equiv["prev_total"]) . "</td>\n\t\t\t<td align='right'>" . sprint($cash_equiv["var_total"]) . "</td>\n\t\t\t<td align='right'><b>" . sprint($cash_equiv["percvar_total"]) . "</b></td>\n\t\t</tr>\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Net cash equivalents beginning of period</td>\n\t\t\t<td align='right'><b>" . sprint($cash_equiv_bop["curr_total"]) . "</b></td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_bop["prev_total"]) . "</td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_bop["var_total"]) . "</td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_bop["percvar_total"]) . "</td>\n\t\t</tr>\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Net cash equivalents end of period</td>\n\t\t\t<td align='right'><b>" . sprint($cash_equiv_eop["curr_total"]) . "</b></td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_eop["prev_total"]) . "</td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_eop["var_total"]) . "</td>\n\t\t\t<td align='right'>" . sprint($cash_equiv_eop["percvar_total"]) . "</td>\n\t\t</tr>";
    if (!$print_func) {
        $pf = "";
        foreach ($cat_list as $key => $value) {
            if (!isset(${"acc_{$key}"})) {
                continue;
            }
            foreach (${"acc_{$key}"} as $k => $v) {
                $pf .= "<input type='hidden' name='acc_{$key}" . "[{$k}]' value='{$v}' />";
            }
        }
        $OUTPUT .= "\n\t\t{$pf}\n\t\t<tr>\n\t\t\t<td colspan='5' align='center'>\n\t\t\t\t<input type='submit' value='Accounts'>\n\t\t\t\t<input type='submit' name='key' value='Save'>\n\t\t\t\t<input type='submit' name='key' value='Print'>\n\t\t\t\t<input type='submit' name='key' value='Export to Spreadsheet'>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</form>";
    } else {
        $OUTPUT .= "\n\t\t</table>";
    }
    if ($print_func) {
        $OUTPUT = clean_html($OUTPUT);
        switch (strtolower($_POST["key"])) {
            case "print":
                require "../tmpl-print.php";
                break;
            case "save":
                db_conn("core");
                $sql = "INSERT INTO save_cashflow (output, div) VALUES ('" . base64_encode($OUTPUT) . "', '" . USER_DIV . "')";
                $svincRslt = db_exec($sql) or errDie("Unable to save the balance sheet to Cubit.");
                return "<li>Cash Flow Statement has been successfully saved to Cubit.</li>";
                break;
            case "export to spreadsheet":
                require "../xls/temp.xls.php";
                Stream("cashflow", $OUTPUT);
                break;
        }
    } else {
        $OUTPUT .= "\n\t\t<p>\n\t\t<center>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=25%>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='datacell'><td align='center'><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td></tr>\n\t\t\t<tr class='datacell'><td align='center'><a href='index-reports.php'>Financials</a></td></tr>\n\t\t\t<tr class='datacell'><td align='center'><a href='index-reports-stmnt.php'>Current Year Financial Statements</a></td></tr>\n\t\t\t<tr class='datacell'><td align='center'><a href='../main.php'>Main Menu</td></tr>\n\t\t</table>\n\t\t</center>";
    }
    return $OUTPUT;
}
コード例 #16
0
function viewtran($_POST)
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($fprd, "string", 1, 14, "Invalid from period number.");
    $v->isOk($tprd, "string", 1, 14, "Invalid to period number.");
    $v->isOk($accnt, "string", 1, 5, "Invalid Accounts Selection.");
    $v->isOk($year, "string", 3, 4, "Invalid year.");
    if ($accnt == 'slct') {
        if (isset($stkids)) {
            foreach ($stkids as $key => $stkid) {
                $v->isOk($stkid, "num", 1, 20, "Invalid Stock code.");
            }
        } else {
            return "<li class='err'>ERROR : Please select at least one Stock Item.</li>" . slctacc($_POST);
        }
    }
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Get the ids
    if ($accnt == 'all') {
        $stkids = array();
        db_connect();
        $sql = "SELECT stkid FROM stock WHERE div = '" . USER_DIV . "'";
        $rs = db_exec($sql);
        if (pg_num_rows($rs) > 0) {
            while ($ac = pg_fetch_array($rs)) {
                $stkids[] = $ac['stkid'];
            }
        } else {
            return "<li calss='err'> There are no Stock Items yet in Cubit.</li>";
        }
    }
    $hide = "";
    # Period name
    $prds = array();
    if ($tprd < $fprd) {
        for ($i = $fprd; $i <= 12; ++$i) {
            $prds[] = $i;
        }
        for ($i = 1; $i <= $tprd; ++$i) {
            $prds[] = $i;
        }
    } else {
        for ($i = $fprd; $i <= $tprd; ++$i) {
            $prds[] = $i;
        }
    }
    db_conn('core');
    $Sl = "SELECT * FROM year WHERE yrdb='{$year}'";
    $Ri = db_exec($Sl) or errDie("Unable to get data.");
    $yd = pg_fetch_array($Ri);
    $audit_db = "{$yd['yrname']}_audit";
    $sp = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $trans = "";
    foreach ($stkids as $key => $stkid) {
        $stkRs = get("cubit", "*", "stock", "stkid", $stkid);
        $stk = pg_fetch_array($stkRs);
        $trans .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='8' align='center'><h3>{$stk['stkcod']} - {$stk['stkdes']}</h3></td>\n\t\t\t</tr>";
        $hide .= "<input type='hidden' name='stkids[]' value='{$stkid}'>";
        foreach ($prds as $prd) {
            $prdname = getMonthName($prd);
            $trans .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='8'>{$prdname}</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>DATE</th>\n\t\t\t\t\t<th>DETAILS</th>\n\t\t\t\t\t<th>QTY</th>\n\t\t\t\t\t<th>COST AMOUNT</th>\n\t\t\t\t\t<th>BALANCE</th>\n\t\t\t\t</tr>";
            # Get balances
            $idRs = get($audit_db, "max(id), min(id)", "{$prdname}_stkledger", "yrdb='{$year}' AND stkid", $stkid);
            $id = pg_fetch_array($idRs);
            $id['min'] += 0;
            $id['max'] += 0;
            $balRs = get($audit_db, "qty, (bqty - qty) as bqty, trantype, (balance - csamt) as balance", "{$prdname}_stkledger", "id", $id['min']);
            $bal = pg_fetch_array($balRs);
            $cbalRs = get($audit_db, "balance", "{$prdname}_stkledger", "id", $id['max']);
            $cbal = pg_fetch_array($cbalRs);
            /*
            if($bal['trantype'] == 'dt'){
            	$bal['bqty'] =  ($bal['bqty'] + $bal['qty']);
            }else{
            	$bal['bqty'] =  ($bal['bqty'] - $bal['qty']);
            }
            */
            $get_yr = "SELECT yrname FROM core.year WHERE yrdb = '{$year}' LIMIT 1";
            $run_yr = db_exec($get_yr) or errDie("Unable to get year information.");
            if (pg_numrows($run_yr) > 0) {
                $yarr = pg_fetch_array($run_yr);
                $tmpyear = substr($yarr['yrname'], 1);
            } else {
                $tmpyear = date("Y") - 1;
            }
            $get_last_prdmap = "SELECT period FROM core.prdmap WHERE month = '12'";
            $run_last_prdmap = db_exec($get_last_prdmap) or errDie("Unable to get last month period");
            if (pg_numrows($run_last_prdmap) > 0) {
                $lastperiod = pg_fetch_result($run_last_prdmap, 0, 0);
            }
            $get_current_prd = "SELECT period FROM core.prdmap WHERE month = '{$prd}' LIMIT 1";
            $run_current_prd = db_exec($get_current_prd) or errDie("Unable to get period information.");
            if (pg_fetch_array($run_current_prd) > 0) {
                $currentperiod = pg_fetch_result($run_current_prd, 0, 0);
                if ((int) $lastperiod >= (int) $currentperiod) {
                    $show_year = $tmpyear - 1;
                } else {
                    $show_year = $tmpyear;
                }
            }
            $balance = sprint($bal['balance']);
            $trans .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='5'><b>({$stk['stkcod']}) {$stk['stkdes']}</b></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='bg-even'>\n\t\t\t\t\t<td>&nbsp; {$show_year}-{$prd}-01</td>\n\t\t\t\t\t<td>Balance Brought Forward</td>\n\t\t\t\t\t<td align='right'>{$bal['bqty']}</td>\n\t\t\t\t\t<td align='right'>&nbsp;</td>\n\t\t\t\t\t<td align='right'>{$balance} </td>\n\t\t\t\t</tr>";
            # --> transactio reding comes here <--- #
            $dbal['balance'] = 0;
            $dbal['bqty'] = 0;
            $tranRs = nget($audit_db, "*", "{$prdname}_stkledger", "yrdb='{$year}' AND stkid", $stkid . " ORDER BY id ASC");
            while ($tran = pg_fetch_array($tranRs)) {
                $dbal['balance'] += $tran['csamt'];
                $dbal['bqty'] += $tran['qty'];
                # sprinting
                $tran['csamt'] = sprint($tran['csamt']);
                $tran['balance'] = sprint($tran['balance']);
                # Format date
                $tran['edate'] = explode("-", $tran['edate']);
                $tran['edate'] = $tran['edate'][2] . "-" . $tran['edate'][1] . "-" . $tran['edate'][0];
                $trans .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$tran['edate']}</td>\n\t\t\t\t\t\t<td>{$tran['details']}</td>\n\t\t\t\t\t\t<td align='right'>{$tran['qty']}</td>\n\t\t\t\t\t\t<td align='right'>{$tran['csamt']}</td>\n\t\t\t\t\t\t<td align='right'>{$tran['balance']}</td>\n\t\t\t\t\t</tr>";
            }
            $dbal['balance'] = sprint($dbal['balance']);
            $trans .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><br></td>\n\t\t\t\t\t<td>Total for period {$prdname} to Date:</td>\n\t\t\t\t\t<td align='right'>{$dbal['bqty']}</td>\n\t\t\t\t\t<td align='right'>{$dbal['balance']} </td>\n\t\t\t\t\t<td align='right'>{$dbal['balance']} </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td colspan='5'><br></td></tr>";
        }
    }
    $sp = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $view = "\n\t\t<center>\n\t\t<form action='../xls/stock-ledger-audit-xls.php' method='POST'>\n\t\t\t<input type='hidden' name='key' value='viewtran'>\n\t\t\t<input type='hidden' name='accnt' value='{$accnt}'>\n\t\t\t<input type='hidden' name='year' value='{$year}'>\n\t\t\t<input type='hidden' name='prd' value='{$prd}'>\n\t\t\t<input type='hidden' name='accnt' value='{$accnt}'>\n\t\t\t<input type='hidden' name='fprd' value='{$fprd}'>\n\t\t\t<input type='hidden' name='tprd' value='{$tprd}'>\n\t\t\t{$hide}\n\t\t<h3>Inventory Ledger</h3>\n\t\t<table " . TMPL_tblDflts . " width='75%'>\n\t\t\t{$trans}\n\t\t\t<tr>\n\t\t\t\t<td colspan='8' align='center'><input type='submit' value='Export to Spreadsheet'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
    return $view;
}
コード例 #17
0
function close_month($year, $month)
{
    if ($month == 12) {
        $nxprd = 1;
    } else {
        $nxprd = $month + 1;
    }
    $month_names = array(0, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    $periodname = getMonthName($month);
    // copy the trial balance to the new table
    core_connect();
    $sql = "INSERT INTO {$year}.{$periodname} (accid, topacc, accnum, accname, debit, credit, div)\n\t\t\tSELECT accid, topacc, accnum, accname, debit, credit, div FROM core.trial_bal WHERE month='{$month}'";
    db_exec($sql) or die($sql);
    $sql = "INSERT INTO \"{$nxprd}\".openbal (accid, accname, debit, credit, div)\n\t\t\tSELECT accid, accname, debit, credit, div FROM core.trial_bal WHERE month='{$month}'";
    db_exec($sql) or die($sql);
    $sql = "INSERT INTO \"{$month}\".ledger (acc, contra, edate, sdate, eref, descript, credit, debit, div,\n\t\t\t\tcaccname, ctopacc, caccnum, cbalance, dbalance)\n\t\t\tSELECT accid, accid, CURRENT_DATE, CURRENT_DATE, '0', 'Balance', '0', '0', div, accname, topacc,\n\t\t\t\taccnum, credit, debit\n\t\t\tFROM core.trial_bal WHERE month='{$month}'";
    db_exec($sql) or die($sql);
    return true;
}
コード例 #18
0
ファイル: header.php プロジェクト: javierlov/FuentesWeb
<!--ZOOMSTOP-->
<?
require_once($_SERVER["DOCUMENT_ROOT"]."/constants.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/../Common/miscellaneous/date_utils.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/../Common/miscellaneous/string_utils.php");


$params = array(":usuario" => getWindowsLoginName(true));
$sql =
	"SELECT 1
		 FROM use_usuarios
		WHERE se_usuario IN ('ALAPACO', 'FPEREZ')
			AND se_usuario = :usuario";
$isSegInfo = existeSql($sql, $params);

$today = stringToUpper(getDayName(date("N")))." ".date("j")." DE ".stringToUpper(getMonthName(date("n")))." DE ".date("Y");
?>
<div>
	<div id="divImagenCabecera"><img id="imgImagenCabecera" src="/images/header/header_logo_1.jpg" usemap="#inicio" /></div>
<?
if (isset($_REQUEST["vistaprevia"])) {
?>
	<div id="divVistaPrevia">
		<div><img src="/modules/portada/images/vista_previa.png" title="Vista Previa" /></div>
		<div><a href="javascript:limpiarVistaPrevia()"><img src="/modules/portada/images/limpiar_vista_previa.png" title="Limpiar Vista Previa" /></a></div>
	</div>
<?
}

if ($isSegInfo) {
?>
コード例 #19
0
ファイル: date.php プロジェクト: jin255ff/company_website
/**
 * Returns the localized representation of the date/time.
 *
 * @param string date_format The format for the date, like the input for the PHP date() function.
 * @param int stamp the timestamp to convert
 * @return string a full date representation
 */
function date_intl($date_format, $stamp)
{
    $ret = str_replace(array('D', 'F', 'l', 'M'), array('$1', '$2', '$3', '$4'), $date_format);
    // to reduce the date calls we retrieve m and w in the same call
    $ret = date('w#m#' . $ret, $stamp);
    // extract day and month in order to replace later by intl day and month
    $aParts = explode('#', $ret);
    $ret = str_replace(array('$1', '$4', '$2', '$3'), array(getDayAbrv($aParts[0]), getMonthAbrv($aParts[1]), getMonthName($aParts[1]), getDayName($aParts[0])), $aParts[2]);
    return $ret;
}
コード例 #20
0
function date_intl($date_format, $stamp)
{
    $ret = str_replace('D', '$1', $date_format);
    $ret = str_replace('F', '$2', $ret);
    $ret = str_replace('l', '$4', $ret);
    $ret = str_replace('M', '$5', $ret);
    $ret = date('$3' . $ret . '$3', $stamp);
    // Workaround for a PHP 4.0.4 problem
    $ret = str_replace('$1', substr(getDayName(date('w', $stamp)), 0, 3), $ret);
    $ret = str_replace('$5', substr(getMonthName(date('m', $stamp)), 0, 3), $ret);
    $ret = str_replace('$2', getMonthName(date('m', $stamp)), $ret);
    $ret = str_replace('$4', getDayName(date('w', $stamp)), $ret);
    $ret = str_replace('$3', '', $ret);
    return $ret;
}
コード例 #21
0
ファイル: common.php プロジェクト: WeKiNGSRO/OHSystem
function MonthYearForm($startYear = 2013, $page = 'top')
{
    if (!isset($_GET["m"])) {
        $m = date("m");
    } else {
        $m = (int) $_GET["m"];
    }
    if (!isset($_GET["y"])) {
        $y = date("Y");
    } else {
        $y = (int) $_GET["y"];
    }
    $endYear = date("Y");
    ?>
 <input type="hidden" name="<?php 
    echo $page;
    ?>
" />
 <select name="m">
    <?php 
    for ($i = 1; $i <= 12; $i++) {
        if ($m == $i) {
            $s = 'selected="selected"';
        } else {
            $s = '';
        }
        ?>
	<option <?php 
        echo $s;
        ?>
 value="<?php 
        echo $i;
        ?>
"><?php 
        echo getMonthName($i);
        ?>
</option>
	<?php 
    }
    ?>
 </select>
 
  <select name="y">
    <?php 
    //for($i=$startYear; $i<=$endYear; $i++) {
    ?>
	<?php 
    for ($i = $endYear; $i >= $startYear; $i--) {
        if ($y == $i) {
            $s = 'selected="selected"';
        } else {
            $s = '';
        }
        ?>
	<option <?php 
        echo $s;
        ?>
 value="<?php 
        echo $i;
        ?>
"><?php 
        echo $i;
        ?>
</option>
	<?php 
    }
    ?>
 </select>
 <?php 
}
コード例 #22
0
ファイル: functions.php プロジェクト: DinethH/EES
/** date: MON, DD **/
function dateMONDD($string)
{
    $date = explode("-", $string);
    $day = $date[2];
    $year = $date[0];
    $month = strtoupper(substr(getMonthName($date[1]), 0, 3));
    $dateMONDD = $month . " " . $day;
    return $dateMONDD;
}
コード例 #23
0
function multiple_salary($counter = 0, $empnum = 0)
{
    global $_GET;
    extract($_GET);
    if (empty($all)) {
        $all = array();
    } else {
        $all = explode("|", $all);
    }
    if (empty($ded)) {
        $ded = array();
    } else {
        $ded = explode("|", $ded);
    }
    if (empty($frin)) {
        $frin = array();
    } else {
        $frin = explode("|", $frin);
    }
    if (empty($subs)) {
        $subs = array();
    } else {
        $subs = explode("|", $subs);
    }
    $salarr = array("m" => "Per Month", "w" => "Per Week", "f" => "Fortnightly", "h" => "Per Hour");
    $saltyp = extlib_cpsel("saltyp", $salarr, "m");
    $payprd_arr = array("d" => "Daily", "w" => "Weekly", "f" => "Fortnightly", "m" => "Monthly");
    $payprd_day_arr = array("mon" => "Monday", "tue" => "Tuesday", "wed" => "Wendesday", "thu" => "Thursday", "fri" => "Friday");
    if (!isset($payprd)) {
        $payprd = "";
    }
    $payprd = extlib_cpsel("payprd", $payprd_arr, $payprd, "onChange='payprd_change(this);'");
    $payprd_day = extlib_cpsel("payprd_day", $payprd_day_arr, "m");
    $paytarr = array("EFT" => "EFT", "Cheque" => "Cheque", "Cash" => "Cash", "Ledger Account" => "Ledger Account");
    $paytypes = extlib_cpsel("paytype", $paytarr, "Cash");
    // bonus month selection
    $bonus_month = "<select name='sal_bonus_month'>";
    global $ePRDMON;
    for ($i = 1; $i <= 12; $i++) {
        $mon = $ePRDMON[$i];
        $bonus_month .= "<option value='{$mon}'>" . getMonthName($mon) . "</option>";
    }
    $bonus_month .= "</select>";
    $OUTPUT = "\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form id='emplfrm{$counter}'>\n\t\t\t<input type='hidden' name='key' value='salary2'>\n\t\t\t<input type='hidden' name='empnum' value='{$empnum}'>";
    //	<tr>
    //		<td colspan=2 align=right>
    //			<input type=button value='Save' onClick='savesalary();'>
    //		</td>
    //	</tr>
    $OUTPUT .= "\n\t\t<tr>\n\t\t\t<td colspan='2' align='right'><input type='submit' value='Save'></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th colspan='2'>General Salary and Allowances</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><b>Remuneration per Annum</b></td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t<td><input type='text' size='10' name='basic_sal_annum' value='0.00' class='right'></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Salary Calculation</td>\n\t\t\t<td>{$saltyp}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Pay Period</td>\n\t\t\t<td valign='top'>\n\t\t\t\t{$payprd}\n\t\t\t\t<div id='div_payprd_day'>{$payprd_day}</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Pay Type</td>\n\t\t\t<td valign='center'>{$paytypes}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Annual Bonus</td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t<td><input type='text' size='10' name='sal_bonus' value='0.00' class='right'></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Bonus - Month</td>\n\t\t\t<td>{$bonus_month}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t\t<li class='err'>All the amounts here after are monthly amounts.\n\t\t\t\t\tPlease note that in the case of weekly/fortnightly employees the\n\t\t\t\t\tweekly/fortnightly amount needs to be converted to the monthly equivalent\n\t\t\t\t\tusing the following calculation:<br>\n\t\t\t\t\tWeekly: amount x 52 / 12<br>\n\t\t\t\t\tFortnightly: amount x 26 / 12</li>\n\t\t\t</td>\n\t\t</tr>";
    // fringe benefits
    $OUTPUT .= "\n\t\t<tr>\n\t\t\t<th colspan='2'>Fringe Benefits</th>\n\t\t</tr>\n\t  \t<tr class='" . bg_class() . "'>\n\t  \t\t<td>Medical Contribution</td>\n\t  \t\t<td align='right'><div id='div_fringe_medaid'>" . CUR . "0.00</div></td>\n\t  \t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Motorcar 1 Determined Value</td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t<td><input type='text' size='10' name='fringe_car1' value='0.00' class='right'></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Contributions for Use</td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t<td><input type='text' size='10' name='fringe_car1_contrib' value='0.00' class='right'></td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Pays for own Fuel</td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select name='fringe_car1_fuel'>\n\t\t\t\t\t\t\t<option value='0'>No</option>\n\t\t\t\t\t\t\t<option value='1'>Yes</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Pays for Servicing</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<select name='fringe_car1_service'>\n\t\t\t\t\t\t\t\t<option value='0'>No</option>\n\t\t\t\t\t\t\t\t<option value='1'>Yes</option>\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t  \t\t<td colspan='2'><li class='err'>In case of 2 motorcars it is accepted that the second\n\t  \t\t\tvehicle is not used for business purposes. In other cases PAYE has to be\n\t  \t\t\tmanually adjusted when processing salary.</li>\n\t  \t\t</td>\n\t  \t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Motorcar 2 Determined Value</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='fringe_car2' value='0.00' class='right'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Contributions for Use</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='fringe_car2_contrib' value='0.00' class='right'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Pays for own Fuel</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<select name='fringe_car2_fuel'>\n\t\t\t\t\t\t\t\t<option value='0'>No</option>\n\t\t\t\t\t\t\t\t<option value='1'>Yes</option>\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>- Pays for Servicing</td>\n\t\t\t<td>\n\t\t\t\t<table><tr>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select name='fringe_car2_service'>\n\t\t\t\t\t\t\t<option value='0'>No</option>\n\t\t\t\t\t\t\t<option value='1'>Yes</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr></table>\n\t\t\t</td>\n\t\t</tr>";
    $i = 0;
    foreach ($frin as $fid) {
        $OUTPUT .= "\n\t  \t\t<input type='hidden' name='fringeid[{$fid}]' value=''>\n\t  \t\t<tr class='" . bg_class() . "'>\n\t  \t\t\t<td><div id='divfrin[{$fid}]'></div></td>\n\t  \t\t\t<td>\n\t  \t\t\t\t<table>\n\t  \t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><div id='divfrinamt[{$fid}]'>&nbsp;</div></td>\n\t\t\t\t\t\t\t<td><input type='text' size='10' name='fringebens[{$fid}]' value='' class='right'></td>\n\t\t\t\t\t\t\t<td><div id='divfrinperc[{$fid}]'>&nbsp;</div></td>\n\t\t  \t\t\t\t</tr>\n\t\t  \t\t\t</table>\n\t\t\t\t</td>\n\t  \t\t</tr>";
    }
    // allowances
    $OUTPUT .= "\n\t\t<tr>\n\t\t\t<th colspan='2'>Allowances</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Travel Allowance</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='all_travel' value='0.00' class='right'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>";
    $i = 1;
    foreach ($all as $aid) {
        $aid += 0;
        #get allowaccid for this allowance
        $get_allaccid = "SELECT accid FROM allowances WHERE id = '{$aid}' LIMIT 1";
        $run_allaccid = db_exec($get_allaccid) or errDie("Unable to get allowance information.");
        if (pg_numrows($run_allaccid) > 0) {
            #found!
            $aidaccid = pg_fetch_result($run_allaccid, 0, 0);
        } else {
            $aidaccid = 0;
        }
        $OUTPUT .= "\n\t\t\t<input type='hidden' name='allowid[{$aid}]' value=''>\n\t\t\t<input type='hidden' name='allowaccid[{$aid}]' value='{$aidaccid}'>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><div id='divall[{$aid}]'></div></td>\n\t\t\t\t<td>\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><div id='divallamt[{$aid}]'>&nbsp;</div></td>\n\t\t\t\t\t\t\t<td><input type='text' size='10' name='allowances[{$aid}]' value='' class='right'></td>\n\t\t\t\t\t\t\t<td><div id='divallperc[{$aid}]'>&nbsp;</div></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>";
    }
    if (count($subs) > 0) {
        $OUTPUT .= "\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Subsistence Allowances</th>\n\t\t\t</tr>";
    }
    $i = 1;
    foreach ($subs as $sid) {
        $OUTPUT .= "\n\t\t\t<input type='hidden' name='subsname[{$sid}]' value=''>\n\t\t\t<input type='hidden' name='subsacc[{$sid}]' value=''>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><div id='subsname[{$sid}]'></div></td>\n\t\t\t\t<td>\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Amount:</td><td>" . CUR . " <input type='text' name='subsamt[{$sid}]' value=''></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Days:</td><td><input type='text' name='subsdays[{$sid}]' value=''></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>";
    }
    $OUTPUT .= "\n\t\t<tr>\n\t\t\t<th colspan='2'>Deductions: Company Contributions</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>SDL</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='hidden' size='10' name='comp_sdl' value='0' class='right'>1</td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>UIF</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='hidden' size='10' name='comp_uif' value='0' class='right'>1</td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Pension Fund</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='comp_pension' value='0' class='right'></td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Retirement Annuity Fund</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='comp_ret' value='0.00' class='right'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Medical Contribution</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='comp_medical' value='0.00' class='right' onChange='updateMedFringe();'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Provident Fund</td>\n\t\t<td>\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t<td><input type='text' size='10' name='comp_provident' value='0' class='right'></td>\n\t\t\t\t\t<td>%</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
    $i = 0;
    foreach ($ded as $did) {
        /*		$OUTPUT .= "
        		<tr class='".bg_class()."'>
        			<td><div id='divcomp_ded[$did]'></div></td>
        			<td>
        				<table><tr>
        					<td><div id='divcomp_dedamt[$did]'>&nbsp;</div></td>
        					<td><input type=text size=10 name='comp_deductions[$did]' value='' class=right></td>
        					<td><div id='divcomp_dedperc[$did]'>&nbsp;</div></td>
        				</tr></table>
        			</td>
        		</tr>";*/
        $OUTPUT .= "<input type='hidden' size='10' name='comp_deductions[{$did}]' value=''>";
    }
    /*
    	$OUTPUT .= "
    	<tr class='bg-even'>
    		<td>Other</td>
    		<td>
    			<table></tr>
    				<td>".CUR."</td>
    				<td><input type=text size=10 name=comp_other value='0' class=right></td>
    				<td>&nbsp;</td>
    			</tr></table>
    		</td>
    	</tr>";*/
    $OUTPUT .= "<input type='hidden' name='comp_other' value='0'>";
    // deductions
    $OUTPUT .= "\n\t\t<tr>\n\t\t\t<th colspan='2'>Deductions: Employee Contributions</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>UIF</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='hidden' size='10' name='emp_uif' value='0' class='right'>1</td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Pension Fund</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='emp_pension' value='0' class='right'></td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Retirement Annuity Fund</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='emp_ret' value='0.00' class='right'></td>\n\t\t\t\t\t\t<td><li class='err'>To be paid to RA fund by employer</li></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Medical Contribution</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . CUR . "</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='emp_medical' value='0.00' class='right' onChange='updateMedFringe();'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td> - Total Benificiaries<br>(Including Member)</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='text' size='2' name='emp_meddeps' value='0' class='right'></td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Provident Fund</td>\n\t\t\t<td>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td><input type='text' size='10' name='emp_provident' value='0' class='right'></td>\n\t\t\t\t\t\t<td>%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>";
    $i = 1;
    foreach ($ded as $did) {
        $OUTPUT .= "\n\t\t\t<input type='hidden' name='deductid[{$did}]' value=''>\n\t\t\t<input type='hidden' name='deducttype[{$did}]' value=''>\n\t\t\t<input type='hidden' name='deductaccid[{$did}]' value=''>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><div id='divded[{$did}]'></div></td>\n\t\t\t\t<td>\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><div id='divdedamt[{$did}]'>&nbsp;</div></td>\n\t\t\t\t\t\t\t<td><input type='text' size='10' name='deductions[{$did}]' value='' class='right'></td>\n\t\t\t\t\t\t\t<td><div id='divdedperc[{$did}]'>&nbsp;</div></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>";
    }
    /*	$OUTPUT .= "
    	<tr class='bg-even'>
    		<td>Other</td>
    		<td>
    			<table><tr>
    				<td>".CUR."</td>
    				<td><input type=text size=10 name=emp_other value='0' class=right></td>
    				<td>&nbsp;</td>
    			</tr></table>
    		</td>
    	</tr>";*/
    $OUTPUT .= "<input type='hidden' name='emp_other' value='0'>";
    //	<tr>
    //		<td colspan=2 align=right>
    //			<input type=button value='Save' onClick='savesalary();'>
    //		</td>
    //	</tr>
    #old java script method
    $OUTPUT .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Save'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
    //	$OUTPUT .= "
    //	<tr>
    //		<td colspan=2 align=right>
    //			<input type='submit' value='Save'>
    //		</td>
    //	</tr>
    //	</form>
    //	</table>";
    // javascript
    $OUTPUT .= "\n\t\t<script>\n\t\t\tfunction payprd_change(p) {\n\t\t\t\tif ( p.value == \"f\" || p.value == \"w\" ) {\n\t\t\t\t\tdocument.getElementById('div_payprd_day').style.visibility = 'visible';\n\t\t\t\t\tdocument.getElementById('div_payprd_day').style.height = document.getElementById('emplfrm{$counter}').payprd_day.style.height;\n\t\t\t\t} else {\n\t\t\t\t\tdocument.getElementById('div_payprd_day').style.visibility = 'hidden';\n\t\t\t\t\tdocument.getElementById('div_payprd_day').style.height = '0';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// get all the different objects to access\n\t\t\tif ( window.opener.parent.mainframe ) {\n\t\t\t\topdoc = window.opener.parent.mainframe.document;\n\t\t\t} else {\n\t\t\t\topdoc = window.opener.document;\n\t\t\t}\n\n\t\t\topfrm = opdoc.getElementById('emplfrm{$counter}');\n\t\t\tefrm = document.getElementById('emplfrm{$counter}');\n\n\t\t\t// gets the salary info from the opener\n\t\t\tfunction getsalary() {\n\t\t\t\tefrm.saltyp.value = opfrm.saltyp.value;\n\t\t\t\tefrm.payprd.value = opfrm.payprd.value;\n\t\t\t\tefrm.payprd_day.value = opfrm.payprd_day.value;\n\t\t\t\tpayprd_change(efrm.payprd);\n\t\t\t\tefrm.paytype.value = opfrm.paytype.value;\n\t\t\t\tefrm.basic_sal_annum.value = opfrm.basic_sal_annum.value;\n\t\t\t\tefrm.sal_bonus.value = opfrm.sal_bonus.value;\n\t\t\t\tefrm.sal_bonus_month.value = opfrm.sal_bonus_month.value;\n\t\t\t\tefrm.all_travel.value = opfrm.all_travel.value;\n\t\t\t\tefrm.comp_sdl.value = opfrm.comp_sdl.value;\n\t\t\t\tefrm.comp_uif.value = opfrm.comp_uif.value;\n\t\t\t\tefrm.comp_other.value = opfrm.comp_other.value;\n\t\t\t\tefrm.comp_provident.value = opfrm.comp_provident.value;\n\t\t\t\tefrm.comp_medical.value = opfrm.comp_medical.value;\n\t\t\t\tefrm.comp_ret.value = opfrm.comp_ret.value;\n\t\t\t\tefrm.comp_pension.value = opfrm.comp_pension.value;\n\t\t\t\tefrm.emp_uif.value = opfrm.emp_uif.value;\n\t\t\t\tefrm.emp_other.value = opfrm.emp_other.value;\n\t\t\t\tefrm.emp_provident.value = opfrm.emp_provident.value;\n\t\t\t\tefrm.emp_medical.value = opfrm.emp_medical.value;\n\t\t\t\tefrm.emp_meddeps.value = opfrm.emp_meddeps.value;\n\t\t\t\tefrm.emp_ret.value = opfrm.emp_ret.value;\n\t\t\t\tefrm.emp_pension.value = opfrm.emp_pension.value;\n\t\t\t\tefrm.fringe_car1.value = opfrm.fringe_car1.value;\n\t\t\t\tefrm.fringe_car1_contrib.value = opfrm.fringe_car1_contrib.value;\n\t\t\t\tefrm.fringe_car1_fuel.options[opfrm.fringe_car1_fuel.value].selected = true;\n\t\t\t\tefrm.fringe_car1_service.options[opfrm.fringe_car1_service.value].selected = true;\n\t\t\t\tefrm.fringe_car2.value = opfrm.fringe_car2.value;\n\t\t\t\tefrm.fringe_car2_contrib.value = opfrm.fringe_car2_contrib.value;\n\t\t\t\tefrm.fringe_car2_fuel.options[opfrm.fringe_car2_fuel.value].selected = true;\n\t\t\t\tefrm.fringe_car2_service.options[opfrm.fringe_car2_service.value].selected = true;";
    foreach ($frin as $fid) {
        $OUTPUT .= "\n\t\t\t// set the fringe benefit symbol\n\t\t\tfrintype = opfrm.elements['fringetype[{$fid}]'].value;\n\n\t\t\tif ( frintype == 'Amount' ) {\n\t\t\t\tdocument.getElementById('divfrinamt[{$fid}]').innerHTML = '" . CUR . "';\n\t\t\t} else {\n\t\t\t\tdocument.getElementById('divfrinperc[{$fid}]').innerHTML = '%';\n\t\t\t}\n\n\t\t\t// fringeben name\n\t\t\tdocument.getElementById('divfrin[{$fid}]').innerHTML = opfrm.elements['fringename[{$fid}]'].value;\n\n\t\t\t// fringeben fields\n\t\t\tefrm.elements['fringebens[{$fid}]'].value = opfrm.elements['fringebens[{$fid}]'].value;\n\t\t\tefrm.elements['fringeid[{$fid}]'].value = opfrm.elements['fringeid[{$fid}]'].value";
    }
    foreach ($all as $aid) {
        $OUTPUT .= "\n\t\t\t// set the allowance symbol\n\t\t\talltype = opfrm.elements['allowtype[{$aid}]'].value;\n\n\t\t\tif ( alltype == 'Amount' ) {\n\t\t\t\tdocument.getElementById('divallamt[{$aid}]').innerHTML = '" . CUR . "';\n\t\t\t} else {\n\t\t\t\tdocument.getElementById('divallperc[{$aid}]').innerHTML = '%';\n\t\t\t}\n\n\t\t\t// allowance name\n\t\t\tdocument.getElementById('divall[{$aid}]').innerHTML = opfrm.elements['allowname[{$aid}]'].value;\n\n\t\t\t// allowance fields\n\t\t\tefrm.elements['allowances[{$aid}]'].value = opfrm.elements['allowances[{$aid}]'].value;\n\t\t\tefrm.elements['allowid[{$aid}]'].value = opfrm.elements['allowid[{$aid}]'].value;";
    }
    foreach ($subs as $sid) {
        $OUTPUT .= "\n\t\t\t// set the allowance name\n\t\t\tdocument.getElementById('subsname[{$sid}]').innerHTML = opfrm.elements['subsname[{$sid}]'].value;\n\n\t\t\t// set the allowance amount\n\t\t\tefrm.elements['subsamt[{$sid}]'].value = opfrm.elements['subsamt[{$sid}]'].value;\n\n\t\t\t// allowance days\n\t\t\tefrm.elements['subsdays[{$sid}]'].value = opfrm.elements['subsdays[{$sid}]'].value;\n\t\t\tefrm.elements['subsname[{$sid}]'].value = opfrm.elements['subsname[{$sid}]'].value;\n\t\t\tefrm.elements['subsacc[{$sid}]'].value = opfrm.elements['subsacc[{$sid}]'].value;";
    }
    foreach ($ded as $did) {
        $OUTPUT .= "\n\t\t\t// set the deduction symbol\n\t\t\tdedtype = opfrm.elements['deducttype[{$did}]'].value;\n\n\t\t\tif ( dedtype == 'Amount' ) {\n\t\t\t\tdocument.getElementById('divdedamt[{$did}]').innerHTML = '" . CUR . "';\n\t\t\t\t//document.getElementById('divcomp_dedamt[{$did}]').innerHTML = '" . CUR . "';\n\t\t\t} else {\n\t\t\t\tdocument.getElementById('divdedperc[{$did}]').innerHTML = '%';\n\t\t\t\t//document.getElementById('divcomp_dedperc[{$did}]').innerHTML = '%';\n\t\t\t}\n\n\t\t\t// set the deduction name\n\t\t\tdocument.getElementById('divded[{$did}]').innerHTML = opfrm.elements['deductname[{$did}]'].value;\n\t\t\t//document.getElementById('divcomp_ded[{$did}]').innerHTML = opfrm.elements['deductname[{$did}]'].value;\n\n\t\t\t// deduction fields\n\t\t\tefrm.elements['deductions[{$did}]'].value = opfrm.elements['deductions[{$did}]'].value;\n\t\t\tefrm.elements['deductid[{$did}]'].value = opfrm.elements['deductid[{$did}]'].value;\n\t\t\tefrm.elements['deducttype[{$did}]'].value = opfrm.elements['deducttype[{$did}]'].value;\n\t\t\tefrm.elements['deductaccid[{$did}]'].value = opfrm.elements['deductaccid[{$did}]'].value;\n\t\t\t//efrm.elements['comp_deductions[{$did}]'].value = opfrm.elements['comp_deductions[{$did}]'].value;";
    }
    $OUTPUT .= "\n\t\t} // end get salary\n\n\t\t// saves the salary to the opener\n\t\tfunction savesalary() {\n\t\t\t// determine what to display about the salary\n\t\t\tswitch ( efrm.saltyp.value ) {\n\t\t\tcase 'w':\n\t\t\t\tsalperiod = 'per Week';\n\t\t\t\tsaldivisor = 52;\n\t\t\t\tbreak;\n\t\t\tcase 'h':\n\t\t\t\tsalperiod = 'per Hour';\n\t\t\t\tsaldivisor = 52 * opfrm.hpweek.value;\n\t\t\t\tbreak;\n\t\t\tcase 'f':\n\t\t\t\tsalperiod = 'Fortnightly';\n\t\t\t\tsaldivisor = 26;\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\tdefault:\n\t\t\t\tsalperiod = 'per Month';\n\t\t\t\tsaldivisor = 12;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tsalamount = parseFloat(efrm.basic_sal_annum.value) / saldivisor;\n\t\t\tsalamount = salamount.toFixed(2);\n\n\t\t\tsalvalue = '" . CUR . "' + salamount + ' ' + salperiod;\n\n\t\t\t// set the display salary\n\t\t\topdoc.getElementById('div_basic_sal').innerHTML = salvalue;\n\n\t\t\t// set the add employee form elements\n\t\t\topfrm.saltyp.value = efrm.saltyp.value;\n\t\t\topfrm.payprd.value = efrm.payprd.value;\n\t\t\topfrm.payprd_day.value = efrm.payprd_day.value;\n\t\t\topfrm.paytype.value = efrm.paytype.value;\n\t\t\topfrm.basic_sal_annum.value = efrm.basic_sal_annum.value;\n\t\t\topfrm.sal_bonus.value = efrm.sal_bonus.value;\n\t\t\topfrm.sal_bonus_month.value = efrm.sal_bonus_month.value; // each month's number is one more than it's index obviously\n\t\t\topfrm.all_travel.value = efrm.all_travel.value;\n\t\t\n\t\t\topfrm.comp_sdl.value = efrm.comp_sdl.value;\n\t\t\topfrm.comp_uif.value = efrm.comp_uif.value;\n\t\t\topfrm.comp_other.value = efrm.comp_other.value;\n\t\t\topfrm.comp_provident.value = efrm.comp_provident.value;\n\t\t\topfrm.comp_medical.value = efrm.comp_medical.value;\n\t\t\topfrm.comp_ret.value = efrm.comp_ret.value;\n\t\t\topfrm.comp_pension.value = efrm.comp_pension.value;\n\t\t\n\t\t\topfrm.emp_uif.value = efrm.emp_uif.value;\n\t\t\topfrm.emp_other.value = efrm.emp_other.value;\n\t\t\topfrm.emp_provident.value = efrm.emp_provident.value;\n\t\t\topfrm.emp_medical.value = efrm.emp_medical.value;\n\t\t\topfrm.emp_meddeps.value = efrm.emp_meddeps.value;\n\t\t\topfrm.emp_ret.value = efrm.emp_ret.value;\n\t\t\topfrm.emp_pension.value = efrm.emp_pension.value;\n\t\t\n\t\t\topfrm.fringe_car1.value = efrm.fringe_car1.value;\n\t\t\topfrm.fringe_car1_contrib.value = efrm.fringe_car1_contrib.value;\n\t\t\topfrm.fringe_car1_fuel.value = efrm.fringe_car1_fuel.value;\n\t\t\topfrm.fringe_car1_service.value = efrm.fringe_car1_service.value;\n\t\t\topfrm.fringe_car2.value = efrm.fringe_car2.value;\n\t\t\topfrm.fringe_car2_contrib.value = efrm.fringe_car2_contrib.value;\n\t\t\topfrm.fringe_car2_fuel.value = efrm.fringe_car2_fuel.value;\n\t\t\topfrm.fringe_car2_service.value = efrm.fringe_car2_service.value;";
    foreach ($frin as $fid) {
        $OUTPUT .= "\n\t\t\topfrm.elements['fringebens[{$fid}]'].value = efrm.elements['fringebens[{$fid}]'].value;";
    }
    foreach ($all as $aid) {
        $OUTPUT .= "\n\t\t\topfrm.elements['allowid[{$aid}]'].value = efrm.elements['allowid[{$aid}]'].value;\n\t\t\topfrm.elements['allowances[{$aid}]'].value = efrm.elements['allowances[{$aid}]'].value;";
    }
    foreach ($subs as $sid) {
        $OUTPUT .= "\n\t\t\topfrm.elements['subsamt[{$sid}]'].value = efrm.elements['subsamt[{$sid}]'].value;\n\t\t\topfrm.elements['subsdays[{$sid}]'].value = efrm.elements['subsdays[{$sid}]'].value;";
    }
    foreach ($ded as $did) {
        $OUTPUT .= "\n\t\t\topfrm.elements['deductions[{$did}]'].value = efrm.elements['deductions[{$did}]'].value;\n\t\t\topfrm.elements['comp_deductions[{$did}]'].value = efrm.elements['comp_deductions[{$did}]'].value;";
    }
    $OUTPUT .= "\n\t\t\talert = 'test';\n\t\t\t\twindow.close();\n\t\t\t} // end save salary\n\n\t\t\tfunction updateMedFringe() {\n\t\t\t\tmemp = parseFloat(efrm.emp_medical.value);\n\t\t\t\tmcomp = parseFloat(efrm.comp_medical.value);\n\t\t\t\tthrd = (memp + mcomp) / 3 * 2;\n\t\t\t\tif ( (fben = mcomp - thrd) < 0 ) {\n\t\t\t\t\tfben = 0;\n\t\t\t\t}\n\t\t\t\tfben = fben.toFixed(2);\n\t\t\t\tdocument.getElementById('div_fringe_medaid').innerHTML = '" . CUR . " ' + fben;\n\t\t\t}\n\t\t\tdocument.setOnLoad=getsalary();\n\t\t</script>";
    return $OUTPUT;
}
コード例 #24
0
ファイル: global.php プロジェクト: ashikov/book
<?php

$monthes = array(1 => "january", 2 => "february", 3 => "march", 4 => "april", 5 => "may", 6 => "june", 7 => "july", 8 => "august", 9 => "september", 10 => "october", 11 => "november", 12 => "december");
function getMonthName($n)
{
    global $monthes;
    return $monthes[$n];
}
echo getMonthName(2);
コード例 #25
0
ファイル: func.inc.php プロジェクト: umjinsun12/dngshin
/**
 * Change the time format YYYYMMDDHHIISS to the user defined format
 *
 * @param string|int $str YYYYMMDDHHIISS format time values
 * @param string $format Time format of php date() function
 * @param bool $conversion Means whether to convert automatically according to the language
 * @return string
 */
function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
{
    // return null if no target time is specified
    if (!$str) {
        return;
    }
    // convert the date format according to the language
    if ($conversion == TRUE) {
        switch (Context::getLangType()) {
            case 'en':
            case 'es':
                if ($format == 'Y-m-d') {
                    $format = 'M d, Y';
                } elseif ($format == 'Y-m-d H:i:s') {
                    $format = 'M d, Y H:i:s';
                } elseif ($format == 'Y-m-d H:i') {
                    $format = 'M d, Y H:i';
                }
                break;
            case 'vi':
                if ($format == 'Y-m-d') {
                    $format = 'd-m-Y';
                } elseif ($format == 'Y-m-d H:i:s') {
                    $format = 'H:i:s d-m-Y';
                } elseif ($format == 'Y-m-d H:i') {
                    $format = 'H:i d-m-Y';
                }
                break;
        }
    }
    // If year value is less than 1970, handle it separately.
    if ((int) substr($str, 0, 4) < 1970) {
        $hour = (int) substr($str, 8, 2);
        $min = (int) substr($str, 10, 2);
        $sec = (int) substr($str, 12, 2);
        $year = (int) substr($str, 0, 4);
        $month = (int) substr($str, 4, 2);
        $day = (int) substr($str, 6, 2);
        // leading zero?
        $lz = create_function('$n', 'return ($n>9?"":"0").$n;');
        $trans = array('Y' => $year, 'y' => $lz($year % 100), 'm' => $lz($month), 'n' => $month, 'd' => $lz($day), 'j' => $day, 'G' => $hour, 'H' => $lz($hour), 'g' => $hour % 12, 'h' => $lz($hour % 12), 'i' => $lz($min), 's' => $lz($sec), 'M' => getMonthName($month), 'F' => getMonthName($month, FALSE));
        $string = strtr($format, $trans);
    } else {
        // if year value is greater than 1970, get unixtime by using ztime() for date() function's argument.
        $string = date($format, ztime($str));
    }
    // change day and am/pm for each language
    $unit_week = Context::getLang('unit_week');
    $unit_meridiem = Context::getLang('unit_meridiem');
    $string = str_replace(array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'), $unit_week, $string);
    $string = str_replace(array('am', 'pm', 'AM', 'PM'), $unit_meridiem, $string);
    return $string;
}
コード例 #26
0
function write($_POST)
{
    extract($_POST);
    if (isset($back)) {
        unset($_POST["back"]);
        return slctCat($_POST);
    }
    require_lib("validate");
    $v = new validate();
    $v->isOk($type, "string", 1, 2, "Invalid category type.");
    $v->isOk($tab, "string", 1, 14, "Invalid category type.");
    $v->isOk($accname, "string", 1, 50, "Invalid account name.");
    $v->isOk($catid, "string", 1, 50, "Invalid category Id/name.");
    $v->isOk($topacc, "num", 4, 4, "Invalid account number.");
    $v->isOk($accnum, "num", 1, 3, "Invalid account number.");
    $v->isOk($toptype, "string", 1, 255, "Invalid category type.");
    if ($v->isError()) {
        $err = $v->genErrors();
        return $err;
    }
    core_connect();
    $sql = "SELECT * FROM accounts WHERE accname = '{$accname}' AND div = '" . USER_DIV . "'";
    $checkRslt = db_exec($sql) or errDie("Unable to retrieve Account details from database.");
    if (pg_numrows($checkRslt) > 0) {
        $confirm = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' class='err'>Account name already exist.</td>\n\t\t\t</tr>";
        return slctCaterr($type, $tab, $accname, $catid, $topacc, $accnum, $confirm);
        exit;
    }
    # Check Account Number
    core_connect();
    $sql = "SELECT * FROM accounts WHERE topacc = '{$topacc}' AND accnum = '{$accnum}' AND div = '" . USER_DIV . "'";
    $checkRslt = db_exec($sql) or errDie("Unable to retrieve Account details from database.");
    $check = pg_numrows($checkRslt);
    if (pg_numrows($checkRslt) > 0) {
        $confirm = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' class='err'>The Account number is already in use.</td>\n\t\t\t</tr>";
        return slctCaterr($type, $tab, $accname, $catid, $topacc, $accnum, $confirm);
        exit;
    }
    # Begin sql transaction
    pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF);
    // Get the db value of toptype
    $toptype_db = explode(":", $toptype);
    $toptype_db = $toptype_db[0];
    # write to DB
    $sql = "\n\t\tINSERT INTO accounts (\n\t\t\ttopacc, accnum, accname, acctype, catid, div, toptype\n\t\t) VALUES (\n\t\t\t'{$topacc}', '{$accnum}', '{$accname}','{$type}', '{$catid}', '" . USER_DIV . "', '{$toptype_db}'\n\t\t)";
    $catRslt = db_exec($sql) or errDie("Unable to add Account to Database.", SELF);
    # get last inserted id for new acc
    $accid = pglib_lastid("accounts", "accid");
    global $MONPRD;
    $month_names = array(0, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    # insert account into trial Balance
    insert_trialbal($accid, $topacc, $accnum, $accname, $type, 'f', USER_DIV);
    for ($i = 1; $i <= 12; $i++) {
        $periodname = getMonthName($i);
        $sql = "\n\t\t\tINSERT INTO " . YR_DB . ".{$periodname} (\n\t\t\t\taccid, topacc, accnum, accname, debit, credit, div\n\t\t\t) SELECT accid, topacc, accnum, accname, debit, credit, div FROM core.trial_bal WHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
        $sql = "\n\t\t\tINSERT INTO \"{$i}\".openbal (\n\t\t\t\taccid, accname, debit, credit, div\n\t\t\t) SELECT accid, accname, debit, credit, div FROM core.trial_bal WHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
        $sql = "\n\t\t\tINSERT INTO \"{$i}\".ledger (\n\t\t\t\tacc, contra, edate, eref, descript, credit, debit, div, caccname, ctopacc, caccnum, cbalance, dbalance\n\t\t\t) SELECT accid, accid, CURRENT_DATE, '0', 'Balance', '0', '0', div, accname, topacc, accnum, credit, debit \n\t\t\tFROM core.trial_bal \n\t\t\tWHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
    }
    pglib_transaction("COMMIT") or errDie("Unable to start a database transaction.", SELF);
    block();
    //			print "
    //			<script>
    //				window.opener.location.reload();
    //				window.close();
    //			</script>";
    if (isset($update_parent) and $update_parent == "yes") {
        #do something to reload the parent window ...
        print "\n\t\t\t<script>\n\t\t\t\twindow.opener.document.form.key.value='{$set_key}';\n\t\t\t\twindow.opener.document.form.submit ();\n\t\t\t\twindow.close();\n\t\t\t</script>";
    } else {
        #do normal return
        # status report
        $write = "\n\t\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>New Account</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t<td>New Account, <b>({$topacc}/{$accnum}) - {$accname}</b> was successfully added to Cubit.</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("../reporting/allcat.php", "List All Accounts (New Window)", true), ql("acc-view.php", "View Accounts"), ql("acc-new2.php", "Add Account"));
        return $write;
    }
}
コード例 #27
0
ファイル: multirotate.php プロジェクト: microlefes/Game
}
$result = $sql->fetchAll();
if (is_array($result)) {
    foreach ($result as $row) {
        echo "Verschiebe Spieler mit der ID " . $row["LoginID"] . ": " . $row["user"] . "\n";
        $sql = $db_game->prepare("SELECT tribe \n                              FROM " . PLAYER_TABLE . " \n                              WHERE name = :user");
        $sql->bindValue('user', $row['user'], PDO::PARAM_STR);
        if (!$sql->execute()) {
            echo "Rotate Multi: Failed to get old tribe from Player\n";
            exit(1);
        }
        //Nachricht f�r den alten Stamm erzeugen
        if ($row2 = $sql->fetch()) {
            if ($row2['tribe'] != "") {
                $time = getUgaAggaTime(time());
                $month = getMonthName($time['month']);
                $sql2 = $db_game->prepare("INSERT INTO " . TRIBE_HISTORY_TABLE . " \n                                   (tribe, timestamp, ingameTime, message) \n                                   VALUES \n                                   (:tribe, NOW(), :timestamp, :message)");
                $sql2->bindValue('tribe', $row2['tribe'], PDO::PARAM_STR);
                $sql2->bindValue('ingameTime', $time['day'] . "{$month}<br>im Jahr " . $time['year'], PDO::PARAM_STR);
                $sql2->bindValue('message', "Spieler " . $row['user'] . " wurde in den Stamm Multi �berf�hrt", PDO::PARAM_STR);
                if (!$sql->execute()) {
                    echo "Rotate Multi: Failed to update old tribehistory\n";
                    exit(1);
                }
                $sql->closeCursor();
            }
        }
        $sql->closeCursor();
        //Player in Multistamm packen
        $sql = $db_game->prepare("UPDATE " . PLAYER_TABLE . " \n                              SET tribe = 'multi' \n                              WHERE name = :user");
        $sql->bindValue('user', $row['user'], PDO::PARAM_STR);
コード例 #28
0
ファイル: _form.php プロジェクト: qhyabdoel/hris_mujigae
<?php

$label_class = 'col-md-3 col-xs-12 control-label';
$monthName = getMonthName();
$years = array();
for ($i = $model->year + 1; $i >= $model->year - 5; $i--) {
    $years[$i] = $i;
}
?>

<?php 
echo CHtml::beginForm('', 'post', array('class' => 'form-horizontal'));
?>
<div class="row">
    <div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<p class="note">Fields with <span class="required">*</span> are required.</p>
			</div>

			<div class="panel-body">
				<div class="form-group">
					<?php 
echo CHtml::activeLabelEx($model, 'department_id', array('class' => $label_class));
?>
					<div class="col-md-6 col-xs-12">
						<?php 
echo CHtml::activeDropDownList($model, 'department_id', CHtml::listData(MastersDepartments::model()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select'));
?>
						
						<?php 
コード例 #29
0
ファイル: event_request.php プロジェクト: DinethH/EES
         </td>
         <td>  
           	<select name="month">
             	<option value="-1">-month-</option>
                 <?php 
 for ($i = 1; $i <= 12; $i++) {
     if ($i < 10) {
         $val = "0" . $i;
     } else {
         $val = $i;
     }
     echo '<option ';
     if (!isset($success_message) && isset($_POST['month']) && $_POST['month'] == $val) {
         echo 'selected';
     }
     echo ' value="' . $val . '">' . getMonthName($val) . '</option>';
 }
 ?>
             </select> 
             <select name="day">
             	<option value="-1">-day-</option>
                  <?php 
 for ($i = 1; $i <= 31; $i++) {
     if ($i < 10) {
         $val = "0" . $i;
     } else {
         $val = $i;
     }
     echo '<option ';
     if (!isset($success_message) && isset($_POST['day']) && $_POST['day'] == $val) {
         echo 'selected';
コード例 #30
0
$periodoActual = date("Y-m");
$periodos = array();

if (is_dir($dir))
	if ($gd = opendir($dir)) {
		while (($ano = readdir($gd)) !== false)
			if (($ano != ".") and ($ano != "..") and (is_dir($dir."/".$ano)))
				if ($gd2 = opendir($dir."/".$ano)) {
					while (($mes = readdir($gd2)) !== false)
						if (($mes != ".") and ($mes != ".."))
							if ($ano."-".$mes != $periodoActual)
								array_push($periodos, $ano."-".$mes);
					closedir($gd2);
				}
		closedir($gd);
	}
rsort($periodos);		// Ordeno el array descendentemente..


foreach($periodos as $value) {
	$vals = explode("-", $value);
	$list->addItem(new ItemList("/boletin-oficial/".$vals[0]."/".$vals[1], "Boletines del Mes de ".getMonthName(date("m", strtotime($vals[1]."/1/2000")))." ".$vals[0], "_self", false, true));
}

$list->setCols(1);
$list->setColsWidth(320);
$list->setImagePath("/modules/boletin_oficial/images/flecha.gif");
$list->setTitleAlign("center");
$list->draw();
?>
<a href="/boletin-oficial"><input class="btnVolver" type="button" value="" /></a>