function generateIdDoc($type, $company, $order)
{
    //[X : typedocument][XX : Year][X : country][XXXX : id commande]
    $year = date('y');
    $country = 5;
    $typedocument = $type;
    $country_company = $company->getNationality();
    $extraction = new extraction();
    $allPartners = $extraction->get('partner');
    $id_order = $order->getId();
    $id_to_print = "";
    $count = strlen((string) $id_order);
    for ($i = 0; $i < 4 - $count; $i++) {
        $id_to_print .= "0";
    }
    $id_to_print .= $id_order;
    foreach ($allPartners as $partner) {
        if ($partner->getCountry() == $country_company) {
            $country = $partner->getRef();
            break;
        }
    }
    //id commande à replacer par référence commande quand ce sera fait
    $id_document = $typedocument . $year . $country . $id_to_print;
    return $id_document;
}
<?php

require_once 'checkSession.php';
require_once '../model/parameter.php';
require_once '../model/extraction.php';
$extraction = new extraction();
$parameters = $extraction->get("parameter");
function compare($a, $b)
{
    return intval($a->getRef()) - intval($b->getRef());
}
usort($parameters, "compare");
include '../view/parameters.php';
Beispiel #3
0
    public function printToAdd($next)
    {
        $extraction = new extraction();
        if ($this->billing_address == NULL) {
            $this->getBillingAddress();
        }
        $groups = $extraction->get("group_company");
        echo '
				<input type="hidden" name="id" value="' . $this->id . '">
				<input type="hidden" name="next" value="' . $next . '">
				<input type="hidden" name="class" value="company">
				<div class="form-group">
					<label for="name">' . $this->tf->getText(25) . '</label>
					<input name="name" type="text" class="form-control" value="' . $this->name . '">
				</div>
				<div class="form-group">
					<label for="nationality">' . $this->tf->getText(50) . '</label>
					<input name="nationality" type="text" class="form-control" value="' . $this->nationality . '">
				</div>
				<div class="form-group">
					<label for="countryWhoBill">Country who bill</label>
					<input name="countryWhoBill" type="text" class="form-control" value="' . $this->countryWhoBill . '">
				</div>
				<div class="form-group">
					<label for="description">' . $this->tf->getText(42) . '</label>
					<input name="description" type="text" class="form-control" value="' . $this->description . '">
				</div>
				<div class="form-group">
					<label for="phone_number">' . $this->tf->getText(45) . '</label>
					<input name="phone_number" type="text" class="form-control" value="' . $this->phone_number . '">
				</div>
				<div class="form-group">
					<label for="id_contact">' . $this->tf->getText(43) . ' ' . $this->tf->getText(69) . '</label>
					<input type="text" id="contact" class="form-control" value="' . $this->contact->getName() . ' | ' . $this->contact->getMail() . ' | ' . $this->contact->getPhone_number() . '">
					<input name="id_contact" type="hidden" class="form-control" value="' . $this->id_contact . '">
					<button id="getContact" alt="company" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button></a>
					<button id="addContact" alt="company" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button></a>
				</div>
				<div class="form-group">
					<label for="id_billing_address">' . $this->tf->getText(87) . ' ' . $this->tf->getText(69) . '</label>
					<input type="text" id="billing_address" class="form-control" value="' . str_replace('<br/>', ' ', $this->billing_address->printAddress()) . '">
					<input name="id_billing_address" type="hidden" class="form-control" value="' . $this->id_billing_address . '">
					<button id="addAddress" alt="company" step="billing_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button></a>
					<button id="setAddress" alt="company" step="billing_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></button></a>
					<button id="getAddress" alt="company" step="billing_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button></a>
				</div>
				<div class="form-group">
					<label for="id_receiving_address">' . $this->tf->getText(88) . ' ' . $this->tf->getText(69) . '</label>
					<input type="text" id="receiving_address" class="form-control" value="' . str_replace('<br/>', ' ', $this->receiving_address->printAddress()) . '">
					<input name="id_receiving_address" type="hidden" class="form-control" value="' . $this->id_receiving_address . '">
					<button id="addAddress" alt="company" step="receiving_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button></a>
					<button id="setAddress" alt="company" step="receiving_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></button></a>
					<button id="getAddress" alt="company" step="receiving_address" rel="' . $this->id . '" class="display btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button></a>
				</div>
				';
        echo '
				<div class="form-group">
					<label for="id_group_company">' . $this->tf->getText(85) . '</label>
					<select name="id_group_company" class="form-control">
					';
        foreach ($groups as $group) {
            echo 'hey';
            if ($this->id_group_company == $group->getId()) {
                echo '<option selected="selected" value="' . $group->getId() . '">' . ucfirst($group->getDesignation()) . '</option>';
            } else {
                echo '<option value="' . $group->getId() . '">' . ucfirst($group->getDesignation()) . '</option>';
            }
        }
        echo '
					</select>
				</div>
				<div class="form-group">
					<label for="ust_id">UST Id</label>
					<input name="ust_id" type="text" class="form-control" value="' . $this->ust_id . '">
				</div>
				<div class="form-group">
					<label for="normal_billing_period">' . $this->tf->getText(86) . '</label>
					<input name="normal_billing_period" type="text" class="form-control" value="' . $this->normal_billing_period . '">
				</div>
			';
    }
<?php

require_once '../model/order.php';
require_once '../model/company.php';
require_once '../model/extraction.php';
$order = new order($_GET['id']);
$company = new company($order->getId_company());
$receiving_address = new address($company->getId_receiving_address());
// Génération du n° Document
//[X : typedocument][XX : Year][X : country][XXXX : id commande]
$typedocument = 7;
$year = date('y');
$country = 5;
$country_company = $company->getNationality();
$extraction = new extraction();
$allPartners = $extraction->get('partner');
$id_order = $order->getId();
$id_to_print = "";
$count = strlen((string) $id_order);
for ($i = 0; $i < 4 - $count; $i++) {
    $id_to_print .= "0";
}
$id_to_print .= $id_order;
foreach ($allPartners as $partner) {
    if ($partner->getCountry() == $country_company) {
        $country = $partner->getRef();
        break;
    }
}
//id commande à replacer par référence commande quand ce sera fait
$id_document = $typedocument . $year . $country . $id_to_print;
<?php

require_once 'checkSession.php';
require_once '../model/group_company.php';
require_once '../model/extraction.php';
$extraction = new extraction();
$group_companies = $extraction->get("group_company");
include '../view/groupCompanies.php';
<?php

require_once '../model/extraction.php';
require_once '../model/company.php';
$data = $_GET["address"];
$data = json_decode($data, true);
$extraction = new extraction();
$results = $extraction->get('company');
echo '<input id="lookCompany" class="form-control" type="text">';
foreach ($results as $company) {
    echo '<div class="ctn-addresses">';
    echo '<div class="ctn-address">';
    echo '<p>' . $company->printText() . '<p>';
    echo '</div>';
    echo '<button class=" btn btn-primary sendCompany" rel="' . $data["idFor"] . '" alt="' . $company->getId() . '"class="btn btn-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></button>';
    echo '</div>';
}