sqltable2.php 3.17 KB
Newer Older
Feu's avatar
Feu committed
1 2 3 4 5 6 7 8 9 10
<?php
$topdir="../";

require_once($topdir."include/site.inc.php");
require_once($topdir."include/cts/sqltable2.inc.php");

$site = new site();
$site->add_js("js/sqltable2.js");
$site->add_css("css/sqltable2.css");

Feu's avatar
Feu committed
11
$site->start_page("sas", "Test de sqltable2" );
Feu's avatar
Feu committed
12
$cts = new contents("table");
Feu's avatar
Feu committed
13
$sql = "SELECT " .
Feu's avatar
Feu committed
14 15 16 17 18
		"`cpta_operation`.`id_op`, " .
		"`cpta_operation`.`num_op`, " .
		"`cpta_operation`.`date_op`, " .
		"`cpta_operation`.`op_effctue`, " .
		"`cpta_operation`.`commentaire_op`, " .
19

Feu's avatar
Feu committed
20
		"`cpta_operation`.`num_cheque_op`, " .
21
		"`cpta_operation`.`mode_op`, " .
Feu's avatar
Feu committed
22 23

		"(IF(`cpta_op_plcptl`.`type_mouvement` IS NULL,`cpta_op_clb`.`type_mouvement`,`cpta_op_plcptl`.`type_mouvement`)*`montant_op`) as `montant`, " .
24

Feu's avatar
Feu committed
25 26
		"`cpta_op_clb`.`libelle_opclb`, " .
		"`cpta_op_plcptl`.`code_plan`, " .
27

Feu's avatar
Feu committed
28 29
		"`entreprise`.`nom_entreprise`, " .
		"`entreprise`.`id_ent`, " .
30

Feu's avatar
Feu committed
31 32
		"`asso`.`id_asso`, " .
		"`asso`.`nom_asso`, " .
Feu's avatar
Feu committed
33 34 35

		"`cpta_cpasso`.`id_cptasso`, " .
		"CONCAT(`asso2`.`nom_asso`,' sur ',`cpta_cpbancaire`.`nom_cptbc` ) AS `nom_cptasso`, " .
36

Feu's avatar
Feu committed
37
		"`utilisateurs`.`id_utilisateur`, " .
Feu's avatar
Feu committed
38
		"CONCAT(`utilisateurs`.`prenom_utl`,' ',`utilisateurs`.`nom_utl`) as `nom_utilisateur`, " .
39

Feu's avatar
Feu committed
40
		"`cpta_libelle`.`nom_libelle` ".
41

Feu's avatar
Feu committed
42 43 44 45 46 47 48 49 50 51 52
		"FROM `cpta_operation` " .
		"LEFT JOIN `cpta_op_clb` ON `cpta_operation`.`id_opclb`=`cpta_op_clb`.`id_opclb` ".
		"LEFT JOIN `cpta_op_plcptl` ON `cpta_operation`.`id_opstd`=`cpta_op_plcptl`.`id_opstd` ".
		"LEFT JOIN `cpta_cpasso` ON `cpta_operation`.`id_cptasso`=`cpta_cpasso`.`id_cptasso` ".
		"LEFT JOIN `asso` ON `cpta_operation`.`id_asso`=`asso`.`id_asso` ".
		"LEFT JOIN `entreprise` ON `cpta_operation`.`id_ent`=`entreprise`.`id_ent` ".
		"LEFT JOIN `utilisateurs` ON `cpta_operation`.`id_utilisateur`=`utilisateurs`.`id_utilisateur` " .
    "LEFT JOIN `cpta_libelle` ON `cpta_operation`.`id_libelle`=`cpta_libelle`.`id_libelle` ".

		"LEFT JOIN `asso` AS `asso2` ON `cpta_cpasso`.`id_asso`=`asso2`.`id_asso` ".
		"LEFT JOIN `cpta_cpbancaire` ON `cpta_cpasso`.`id_cptbc`=`cpta_cpbancaire`.`id_cptbc` ".
Feu's avatar
Feu committed
53
		"WHERE `cpta_operation`.id_classeur='162' " .
Feu's avatar
Feu committed
54
		"ORDER BY `cpta_operation`.`num_op` DESC" ;
55

Feu's avatar
Feu committed
56

Feu's avatar
Feu committed
57
$tbl = new sqltable2("compte","Test","sqltable2.php");
Feu's avatar
Feu committed
58 59
$tbl->add_column_number("num_op","N°");
$tbl->add_column("date_op","Date");
Feu's avatar
Feu committed
60
$tbl->add_column("nom_libelle","Etiquette");
Feu's avatar
Feu committed
61
$tbl->add_column_price("montant","Montant");
Feu's avatar
Feu committed
62 63
$tbl->add_column("mode_op","Paiement");
$tbl->add_column_number("num_cheque_op","N°");
Feu's avatar
Feu committed
64
$tbl->add_column("acteur","Débiteur/Crediteur",array("nom_utilisateur","nom_entreprise","nom_asso","nom_cptasso"));
Feu's avatar
Feu committed
65
$tbl->add_column_number("code_plan","Code");
Feu's avatar
Feu committed
66 67 68
$tbl->add_column("libelle_opclb","Nature(type)");
$tbl->add_column("op_effctue","Eff.");
$tbl->add_column("commentaire_op","Commentaire");
Feu's avatar
Feu committed
69

Feu's avatar
Feu committed
70
$tbl->set_column_enumeration("op_effctue",array(0=>"Non",1=>"Oui"));
Feu's avatar
Feu committed
71 72 73 74
$tbl->set_column_enumeration("mode_op",array(2=>"Espèces",1=>"Chèque",3=>"Virement",4=>"Carte Bancaire"));

$tbl->set_column_action("op_effctue","done");
$tbl->set_column_action("num_op","edit");
Feu's avatar
Feu committed
75

Feu's avatar
Feu committed
76 77
$tbl->set_column_isdiverse("commentaire_op");

Feu's avatar
Feu committed
78 79 80
$tbl->add_action("delete","Supprimer");
$tbl->add_action("print","Imprimer");

Feu's avatar
Feu committed
81
$tbl->set_sql($site->db,"id_op",$sql);
Feu's avatar
Feu committed
82 83 84 85
$cts->add($tbl,true);
$site->add_contents($cts);
$site->end_page();

86
?>