Exemplo n.º 1
0
    }
    return $val;
}
function adjust_when($when, $m)
{
    $f = explode(" ", $when);
    $day = explode("-", $f[0]);
    $day = intval($day[2]);
    $hour = explode(":", $f[1]);
    $hour = intval($hour[0]);
    return $day . " " . $m . " " . $hour . "h";
}
setlocale(LC_ALL, 'fr_FR.utf8', 'fra');
date_default_timezone_set('Europe/Paris');
get_date($date, $day, $month, $year);
get_period($year, $month, $day, $beginDate, $endDate, $period);
$byEcoute = $_GET["ecoute"];
if (!isset($byEcoute)) {
    $byEcoute = false;
} else {
    $byEcoute = true;
}
/*$display = $_GET["display"];
	if (isset($display)) {
	  if ($display != "list" && $display != "diagrams") // set here the displays
	    $display = "list";
	}
	else
	  $display = "list";*/
$ecoutes = load_ecoutes($beginDate, $endDate, $byEcoute);
if (!$byEcoute) {
Exemplo n.º 2
0
                $inv_paytype = $assign['a_paytype'];
            } elseif ($assign['paytype']) {
                $inv_paytype = $assign['paytype'];
            } elseif ($assign['d_paytype']) {
                $inv_paytype = $assign['d_paytype'];
            } else {
                $inv_paytype = $paytype;
            }
            if ($assign['numberplanid']) {
                $plan = $assign['numberplanid'];
            } else {
                $plan = array_key_exists($divid, $plans) ? $plans[$divid] : 0;
            }
            if ($invoices[$cid] == 0 || $paytypes[$cid] != $inv_paytype || $numberplans[$cid] != $plan) {
                if (!isset($numbers[$plan])) {
                    $period = get_period($periods[$plan]);
                    $numbers[$plan] = ($number = $DB->GetOne("SELECT MAX(number) AS number FROM documents \n\t\t\t\t\t\t\tWHERE cdate >= ? AND cdate <= ? AND type = 1 AND numberplanid = ?", array($period['start'], $period['end'], $plan))) != 0 ? $number : 0;
                    $numbertemplates[$plan] = $DB->GetOne("SELECT template FROM numberplans WHERE id = ?", array($plan));
                }
                $itemid = 0;
                $numbers[$plan]++;
                $customer = $DB->GetRow("SELECT lastname, name, address, city, zip, ssn, ten, countryid, divisionid, paytime \n\t\t\t\t\t\tFROM customeraddressview WHERE id = {$cid}");
                $division = $DB->GetRow('SELECT name, shortname, address, city, zip, countryid, ten, regon,
						account, inv_header, inv_footer, inv_author, inv_cplace 
						FROM divisions WHERE id = ? ;', array($customer['divisionid']));
                $paytime = $customer['paytime'];
                if ($paytime == -1) {
                    $paytime = $deadline;
                }
                $fullnumber = docnumber($numbers[$plan], $numbertemplates[$plan], $currtime);
                $DB->Execute("INSERT INTO documents (number, numberplanid, type, countryid, divisionid, \n\t\t\t\t\tcustomerid, name, address, zip, city, ten, ssn, cdate, sdate, paytime, paytype,\n\t\t\t\t\tdiv_name, div_shortname, div_address, div_city, div_zip, div_countryid, div_ten, div_regon,\n\t\t\t\t\tdiv_account, div_inv_header, div_inv_footer, div_inv_author, div_inv_cplace, fullnumber) \n\t\t\t\t\tVALUES(?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($numbers[$plan], $plan, $customer['countryid'], $customer['divisionid'], $cid, $customer['lastname'] . " " . $customer['name'], $customer['address'], $customer['zip'], $customer['city'], $customer['ten'], $customer['ssn'], $currtime, $saledate, $paytime, $inv_paytype, $division['name'] ? $division['name'] : '', $division['shortname'] ? $division['shortname'] : '', $division['address'] ? $division['address'] : '', $division['city'] ? $division['city'] : '', $division['zip'] ? $division['zip'] : '', $division['countryid'] ? $division['countryid'] : 0, $division['ten'] ? $division['ten'] : '', $division['regon'] ? $division['regon'] : '', $division['account'] ? $division['account'] : '', $division['inv_header'] ? $division['inv_header'] : '', $division['inv_footer'] ? $division['inv_footer'] : '', $division['inv_author'] ? $division['inv_author'] : '', $division['inv_cplace'] ? $division['inv_cplace'] : '', $fullnumber));
<?php

require "../settings.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = generate_recommended($_POST);
            break;
        case "write":
            $OUTPUT = write_report($_POST);
            break;
        default:
            $OUTPUT = get_period();
    }
} else {
    $OUTPUT = get_period();
}
require "../template.php";
function get_period()
{
    global $PRDMON;
    $finstartdate = mkdate(getYearOfFinPrd(1), $PRDMON[1], 1);
    $finenddate = mkldate(getYearOfFinPrd(12), $PRDMON[12]);
    db_connect();
    #get vat period setting
    $get_set = "SELECT * FROM settings WHERE label = 'VAT Period' LIMIT 1";
    $run_set = db_exec($get_set) or errDie("Unable to get vat period information.");
    if (pg_numrows($run_set) < 1) {
        return "\n\t\t\t<li class='err'>Please Set VAT Period Setting Before Continuing.</li>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../vat_period_setting.php'>Set VAT Period</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
    } else {
        $sarr = pg_fetch_array($run_set);