diff --git a/COPYING b/COPYING new file mode 100644 index 00000000000..d60c31a97a5 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/htdocs/comm/actioncomm.class.php3 b/htdocs/comm/actioncomm.class.php3 new file mode 100644 index 00000000000..e179ca00579 --- /dev/null +++ b/htdocs/comm/actioncomm.class.php3 @@ -0,0 +1,76 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +class ActionComm { + var $id; + var $db; + + var $date; + var $type; + var $user; + var $societe; + var $contact; + var $note; + + Function ActionComm($db) { + $this->db = $db; + } + /* + * + * + * + */ + Function add() { + $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author, fk_contact, note) "; + $sql .= " VALUES ('$this->date',$this->type,$this->societe,$this->user,$this->contact,'$this->note')"; + + if ($this->db->query($sql) ) { + + } + } + /* + * + * + * + */ + Function fetch($db, $id) { + + $sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;"; + + if ($db->query($sql) ) { + if ($db->num_rows()) { + $obj = $db->fetch_object(0); + + $this->id = $rowid; + $this->datep = $obj->dp; + $this->ref = $obj->ref; + $this->price = $obj->price; + + $db->free(); + } + } else { + print $db->error(); + } + } +} +?> + diff --git a/htdocs/comm/actioncomm.php3 b/htdocs/comm/actioncomm.php3 new file mode 100644 index 00000000000..8303e7091e0 --- /dev/null +++ b/htdocs/comm/actioncomm.php3 @@ -0,0 +1,243 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +require("./pre.inc.php3"); +require("../lib/functions.inc.php3"); +require("../societe.class.php3"); +require("../contact.class.php3"); +require("cactioncomm.class.php3"); +require("actioncomm.class.php3"); +llxHeader(); +$db = new Db(); +if ($sortfield == "") { + $sortfield="a.datea"; +} +if ($sortorder == "") { + $sortorder="DESC"; +} + +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +print "< Prev\n| "; +print " Next >\n"; + + +$bc1="bgcolor=\"#90c090\""; +$bc2="bgcolor=\"#b0e0b0\""; +/* + * + * + * + */ +if ($action=='add') { + $actioncomm = new ActionComm($db); + $actioncomm->date = $date; + $actioncomm->type = $actionid; + $actioncomm->contact = $contactid; + $actioncomm->user = $user->id; + $actioncomm->societe = $socid; + $actioncomm->note = $note; + + $actioncomm->add(); +} +/* + * + * + * + */ +if ($action=='create' && $actionid && $contactid) { + $caction = new CActioncomm(); + $caction->fetch($db, $actionid); + + $contact = new Contact($db); + $contact->fetch($contactid); + + $societe = new Societe($db); + $societe->get_nom($socid); + + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
Action'.$caction->libelle.'
Société'.$societe->nom.'Contact'.$contact->fullname.'
Auteur'.$user->fullname.'Date'.strftime('%d %B %Y %H:%M',time()).'
Commentaire'; + print '
'; + $limit = 10; + print '

Vos 10 dernières actions'; +} +/* + * + * + * + */ +if ($id) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
Action'.$libelle.'
Société'.$nom.'Contact'.$fullname.'
Auteur'.$fullname.'Date'.strftime('%d %B %Y %H:%M',time()).'
Commentaire'; + print '
'; + $limit = 10; + print '

Vos 10 dernières actions'; +} + +/* + * + * Liste + * + */ + +if ($socid) { + + $sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname "; + $sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u"; +$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; + + if ($type) { + $sql .= " AND c.id = $type"; + } + + $sql .= " ORDER BY $sortfield $sortorder "; + + if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ''; + print ''; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + if ($i == 0) { + print ""; + print ''; + print "\n"; + print ""; + print "\n"; + } + $var=!$var; + + if (!$var) { + $bc=$bc1; + } else { + $bc=$bc2; + } + print ""; + print "\n"; + + print "\n"; + print ''; + print "\n"; + + print ""; + print "\n"; + print ''; + print "\n"; + + $i++; + } + print "
DateSocieteNote
Auteursocidp\">$obj->societe 
" .strftime("%d %b %Y %H:%M",$obj->da)."socidp\">$obj->societe'.nl2br($obj->note).'
$obj->firstname $obj->name'.$obj->libelle.'
"; + $db->free(); + } + +} else { + + +$sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code "; +$sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u"; +$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; + +if ($type) { + $sql .= " AND c.id = $type"; +} + +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit, $offset); + + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + print ""; + print ''; + print ''; + print ''; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + if (!$var) { + $bc=$bc1; + } else { + $bc=$bc2; + } + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + print ''; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
DateSocieteActionAuteur
" .strftime("%d",$obj->da)."" .strftime("%b",$obj->da)."" .strftime("%Y",$obj->da)."" .strftime("%H:%M",$obj->da)."socidp\">$obj->societe'.$obj->libelle.'$obj->code$obj->stcomm
"; + $db->free(); +} + + +} + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/comm/cactioncomm.class.php3 b/htdocs/comm/cactioncomm.class.php3 new file mode 100644 index 00000000000..12c6e3dfede --- /dev/null +++ b/htdocs/comm/cactioncomm.class.php3 @@ -0,0 +1,54 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +class CActioncomm { + var $id; + var $libelle; + + Function CActioncomm() { + + } + /* + * + * + * + */ + Function fetch($db, $id) { + + $sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;"; + + if ($db->query($sql) ) { + if ($db->num_rows()) { + $obj = $db->fetch_object(0); + + $this->id = $id; + $this->libelle = $obj->libelle; + + $db->free(); + } + } else { + print $db->error(); + } + } +} +?> + diff --git a/htdocs/comm/facture.php3 b/htdocs/comm/facture.php3 new file mode 100644 index 00000000000..48616d11d66 --- /dev/null +++ b/htdocs/comm/facture.php3 @@ -0,0 +1,233 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +require("./pre.inc.php3"); +require("../lib/functions.inc.php3"); +llxHeader(); +$db = new Db(); +$author = $GLOBALS["REMOTE_USER"]; +$bc[0]="bgcolor=\"#90c090\""; +$bc[1]="bgcolor=\"#b0e0b0\""; + + +if ($action == 'add') { + $datefacture = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear)); + + $sql = "INSERT INTO llx_facture (facnumber, fk_soc, datec, datef, note, amount, remise, tva, total, author) "; + $sql .= " VALUES ('$facnumber', $socid, now(), $datefacture,'$note', $amount, $remise, $tva, $total, '$author');"; + $result = $db->query($sql); + + if ($result) { + $sql = "SELECT rowid, facnumber FROM llx_facture WHERE facnumber='$facnumber';"; + $result = $db->query($sql); + if ($result) { + $objfac = $db->fetch_object( 0); + $facid = $objfac->rowid; + $facnumber = $objfac->facnumber; + $action = ''; + + $sql = "INSERT INTO llx_fa_pr (fk_facture,fk_propal) VALUES ($facid, $propalid);"; + $result = $db->query($sql); + + + /* + * + * Génération du PDF + * + */ + + print "


Génération du PDF

"; + + $command = "export DBI_DSN=\"".$GLOBALS["DBI"]."\" "; + $command .= " ; ../../scripts/facture-tex.pl --facture=$facid --pdf --gljroot=" . $GLOBALS["GLJ_ROOT"] ; + + $output = system($command); + print "

command : $command
"; + + + + + } + } else { + print "

Erreur : la facture n'a pas été créée, vérifier le numéro !"; + print "

Retour à la propal"; + } + +} elseif ($action == 'create') { + + $sql = "SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.tva, p.total, p.ref, ".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.author"; + $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; + + $sql .= " AND p.rowid = $propalid"; + + if ( $db->query($sql) ) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + + $numfa = "F-" . $obj->prefix_comm . "-" . strftime("%y%m%d", time()); + + print "Emettre une facture

"; + print "

"; + print "price - $obj->remise)."\">"; + print "total\">"; + print ""; + print ""; + print ""; + + + print ""; + print ""; + print ""; + print ""; + + print "remise\">"; + print "tva\">"; + + print ""; + print ""; + print "idp\">"; + + $strmonth[1] = "Janvier"; $strmonth[2] = "Février"; $strmonth[3] = "Mars"; $strmonth[4] = "Avril"; + $strmonth[5] = "Mai"; $strmonth[6] = "Juin"; $strmonth[7] = "Juillet"; $strmonth[8] = "Août"; + $strmonth[9] = "Septembre"; $strmonth[10] = "Octobre"; + $strmonth[11] = "Novembre"; $strmonth[12] = "Décembre"; + + print ""; + $author = $GLOBALS["REMOTE_USER"]; + print ""; + + print ""; + print ""; + print ""; + print ""; + print "
Société :$obj->nomCommentaires :
"; + print "
Propal :$obj->ref
Montant HT :".price($obj->price - $obj->remise)."
TVA :".price($obj->tva)."
Total TTC :".price($obj->total)."
Date :"; + $cday = date("d", time()); + print ""; + $cmonth = date("n", time()); + print ""; + + print "
Auteur :$author
Numéro :
"; + + } + } + + + print "

"; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + + $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; + $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp ORDER BY f.datec DESC "; + + if ( $db->query($sql) ) { + $num = $db->num_rows(); + if ($num > 0) { + $i = 0; $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + + if ($objp->df > 0 ) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + + $yn[1] = "oui"; + $yn[0] = "non"; + + $total = $total + $objp->amount; + print "\n"; + print "\n"; + $i++; + } + print ""; + print ""; + } + $db->free(); + } else { + print ""; + } + print "
SocieteNumDateMontantPayé
idp\">$objp->nomfacid\">$objp->facnumber"; + print strftime("%d %B %Y",$objp->df)."!!!".price($objp->amount)."".$yn[$objp->paye]."
$i facturesTotal : ".francs($total)." FFTotal : ".price($total)."$_MONNAIES HT
".$db->error()."
"; +} + +if ($facid) { + + $sql = "SELECT s.nom,s.idp, f.amount, f.facnumber, f.rowid"; + $sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp"; + $sql .= " AND f.rowid = $facid"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + print "Facture

"; + print ""; + print ""; + print ""; + print ""; + print "
Numero :rowid\">$obj->facnumber
Société :$obj->nom
Montant :$obj->amount
"; + } + } +} + + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/comm/index.php3 b/htdocs/comm/index.php3 new file mode 100644 index 00000000000..752decd7070 --- /dev/null +++ b/htdocs/comm/index.php3 @@ -0,0 +1,913 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +require("./pre.inc.php3"); +require("../lib/functions.inc.php3"); +require("../lib/company.lib.php3"); +llxHeader(); +$db = new Db(); +if ($sortorder == "") { + $sortorder="ASC"; +} +if ($sortfield == "") { + $sortfield="nom"; +} +$bc[0]="bgcolor=\"#c0f0c0\""; +$bc[1]="bgcolor=\"#b0e0b0\""; +$bc2[0]="bgcolor=\"#c9f000\""; +$bc2[1]="bgcolor=\"#b9e000\""; +$active["1"] = "Offres en ligne"; +$active["-1"] = "Moderation"; +$active["-2"] = "Refusées"; +$active["0"] = "Rédaction"; +$active["-3"] = "Désactivées"; +$active["-4"] = "Supprimées"; +$cr["t"] = "Cab. Recrut."; +$cr["f"] = "-"; +$cr[""] = "????"; +$cr["1"] = "Cab. Recrut."; +$cr["0"] = "-"; + +$yn["t"] = "oui"; +$yn["f"] = "non"; +$yn["1"] = "oui"; +$yn["0"] = "non"; + +$deacmeth["b"] = "robots"; +$deacmeth["m"] = "manuelle"; + +if ($action == 'attribute_prefix') { + $prefix_attrib = soc_attribute_prefix($db, $socid); +} + +if ($action == 'cabrecrut') { + if ($selectvalue) { + $sql = "UPDATE societe SET cabrecrut='$selectvalue' WHERE idp=$socid"; + $result = $db->query($sql); + } +} +if ($action == 'recontact') { + $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); + $sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')"; + $result = $db->query($sql); +} + +if ($action == 'note') { + $sql = "UPDATE societe SET note='$note' WHERE idp=$socid"; + $result = $db->query($sql); +} + +if ($action == 'stcomm') { + if ($stcommid <> 'null' && $stcommid <> $oldstcomm) { + $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; + $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')"; + $result = @$db->query($sql); + + if ($result) { + $sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid"; + $result = $db->query($sql); + } else { + $errmesg = "ERREUR DE DATE !"; + } + } + + if ($actioncommid) { + $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, author) VALUES ('$dateaction',$actioncommid,$socid,'" . $GLOBALS["REMOTE_USER"] . "')"; + $result = @$db->query($sql); + + if (!$result) { + $errmesg = "ERREUR DE DATE !"; + } + } +} +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +print "

"; + +print "<- Prev\n| "; +print "*\n| "; +for ($i = 65 ; $i < 91; $i++) { + print ""; + + if ($begin == chr($i) ) { + print "->" . chr($i) . "<-" ; + } else { + print chr($i) ; + } + print " | "; +} +print " Next ->\n"; +print "

"; +/* + * Recherche + * + * + */ +if ($mode == 'search') +{ + if ($mode-search == 'soc') + { + $sql = "SELECT s.idp FROM societe as s, c_stcomm as st "; + $sql .= " WHERE s.fk_stcomm = st.id AND s.datea IS NOT NULL"; + + if ($socname) + { + $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; + $sortfield = "lower(s.nom)"; + $sortorder = "ASC"; + } + + + $result = $db->query($sql); + if ($result) + { + if ( $db->num_rows() == 1) + { + $obj = $db->fetch_object(0); + $socid = $obj->idp; + } + $db->free(); + } + } + else + { + + } + +} + + + +/* + * Mode fiche + * + * + */ +if ($socid > 0) { + + $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc,".$db->pdate("s.datel")." as dl,".$db->pdate("s.datem")." as dm, ".$db->pdate("s.datea")." as da, s.intern, s.cjn, s.c_nom, s.c_prenom, s.c_tel, s.c_mail, s.tel, s.fax, s.fplus, s.cjn, s.viewed, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note,s.karma,s.off_acc, s.off_ref,s.view_res_coord, t.libelle as typent, s.cabrecrut, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e "; + $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; + + if ($to == 'next') { + $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; + } elseif ($to == 'prev') { + $sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1"; + } else { + $sql .= " AND s.idp = $socid"; + } + + $result = $db->query($sql); + + if ($result) { + $objsoc = $db->fetch_object(0); + + $dac = strftime("%Y-%m-%d %H:%M", time()); + if ($errmesg) { + print "$errmesg
"; + } + print "

idp\" method=\"post\">"; + print ""; + print "fk_stcomm\">"; + + $sql = "SELECT st.id, st.libelle FROM c_stcomm as st ORDER BY id"; + $result = $db->query($sql); + print "\n"; + $sql = "SELECT st.id, st.libelle FROM c_actioncomm as st ORDER BY id"; + $result = $db->query($sql); + print "\n"; + + print ""; + print ""; + print "
\n"; + /* + * + */ + print "\n"; + /* + * + */ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
N° $objsoc->idp - $objsoc->nom - [$objsoc->stcomm]idp&action=add\">[Bookmark]idp&action=create\">[Projet]idp&action=create\">[Propal]idp\">Notesidp\">Contactsidp\">Fiche Technique[idp&action=edit\">Editer]
"; + if ($objsoc->parent > 0) { + print "
Société rattaché au cabinet parent\">$objsoc->parent"; + } + print "
"; + print "\n"; + print "\n"; + print "\n"; + /* + * + */ + print ""; + print "
"; + print ""; + + print ""; + print ""; + print ""; + + print ""; + print ""; + + print ""; + + print ""; + print ""; + print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
sirensiren\">$objsoc->siren prefix"; + if ($objsoc->prefix_comm) { + print $objsoc->prefix_comm; + } else { + print "[idp&action=attribute_prefix\">Attribuer]"; + } + + print "
Siteurl\">$objsoc->url 
Contact $objsoc->c_nom $objsoc->c_prenom 
tel$objsoc->c_tel email : $objsoc->c_mail 
"; + + /* + * + */ + print "
"; + if ($objsoc->dl > 0) { + $datel = strftime("%d %b %Y %H:%M", $objsoc->dl); + } else { + $datel = "Pas d'infos"; + } + print ""; + print ""; + //print ""; + print "" ; + print "" ; + print "" ; + + if ($objsoc->cabrecrut == 1) { + print ""; + } elseif ($objsoc->cabrecrut == 0) { + print ""; + } else { + print ""; + } + print ""; + + print ""; + //print "" ; + //print ""; + + print ""; + + print ""; + + print "
Dernière connexion$datel
Créée le" . strftime("%d %b %Y %H:%M", $objsoc->dc) . "
Dernière modif le" . strftime("%d %b %Y %H:%M", $objsoc->dm) . "
Fiche Entreprise".$yn[$objsoc->fplus]."
Coordonnees CV".$yn["$objsoc->view_res_coord"]." 
Contacts CV".$yn["$objsoc->services"]." 
Cab. Recrut. : Oui
Cab. Recrut. : Non
Cab. Recrut. : ???idp&action=changevalue&type=cabrecrut\">changer
"; + //print "
Cojonet".$yn["$objsoc->cjn"]."
Consult Fiche$objsoc->viewed
"; + print "
"; + + print ""; + print ""; + print ""; + print ""; + + $sql = "SELECT count(idp) as cc, active FROM offre WHERE fk_soc = $objsoc->idp GROUP by active ORDER BY active DESC"; + if ( $db->query($sql) ) { + + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $obj = $db->fetch_object( $i); + print ""; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + print "
Karma:$objsoc->karma
Nb d'acceptation:$objsoc->off_acc
Nb de refus:$objsoc->off_ref
".$active["$obj->active"] . ":$obj->cc

"; + print ""; + print ""; + $sql = "SELECT week1 + week2 + week3 + week4 as t, week1, week2, week3, week4 FROM soc_resviewed_byweek WHERE fk_soc = $objsoc->idp"; + if ( $db->query($sql) ) { + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $obj = $db->fetch_object( $i); + print ""; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + print ""; + print ""; + $sql = "SELECT week1 + week2 + week3 + week4 as t, week1, week2, week3, week4 FROM soc_rescontact_byweek WHERE fk_soc = $objsoc->idp"; + if ( $db->query($sql) ) { + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $obj = $db->fetch_object( $i); + print ""; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + + $sql = "SELECT count(idp) as cc FROM abo_soc WHERE fksoc = $objsoc->idp GROUP by active"; + $result = $db->query($sql); + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $obj = $db->fetch_object( $i); + print ""; + $i++; + } + $sql = "SELECT count(idp) as cc FROM socfollowresume WHERE fk_soc = $objsoc->idp"; + if ( $db->query($sql) ) { + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $obj = $db->fetch_object( $i); + print ""; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + print "
CV consultés: $obj->t ( $obj->week1 - $obj->week2 - $obj->week3 - $obj->week4 )
Contacts: $obj->t ( $obj->week1 - $obj->week2 - $obj->week3 - $obj->week4 )
Abonnements: $obj->cc
Cand. suivis: $obj->cc
\n"; + print "
"; + + /* + * Propales + */ + $var=!$var; + print ""; + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; + $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; + $sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC"; + + if ( $db->query($sql) ) { + $num = $db->num_rows(); + if ($num >0 ) { + print ""; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < 2) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + $db->free(); + } + /* + * Factures + */ + $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; + $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC"; + if ( $db->query($sql) ) { + $num = $db->num_rows(); $i = 0; + if ($num > 0) { + print ""; + print ""; + } + + while ($i < $num && $i < 2) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + if ($objp->df > 0 ) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + $paye[1] = "payée"; + $paye[0] = "non payée"; + print "\n"; + print "\n"; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + print "
idp\">liste des propales ($num)
propalid\">$objp->ref\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price - $objp->remise)."$objp->statut
idp\">liste des factures ($num)
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."
"; + + print "
"; + /* + * + * Ventes + * + */ + $sql = "SELECT p.rowid,p.label,p.ref,".$db->pdate("v.dated")." as dd,".$db->pdate("v.datef")." as df"; + $sql .= " FROM llx_product as p, llx_ventes as v WHERE p.rowid = v.fk_product AND v.fk_soc = $objsoc->idp ORDER BY dated DESC"; + if ( $db->query($sql) ) { + print ""; + $i = 0 ; $num = $db->num_rows(); + if ($num > 0) { + $tag = !$tag; print ""; + print ""; + } + while ($i < $num && $i < 5) { + $obj = $db->fetch_object( $i); + $tag = !$tag; + print ""; + $nw = time(); + if ($nw <= $obj->df && $nw >= $obj->dd) { + print ""; + } else { + print ""; + } + print ""; + $i++; + } + $db->free(); + print "
idp\">liste des ventes ($num)
$obj->label$obj->label".strftime("%d %b %Y", $obj->dd) ."".strftime("%d %b %Y", $obj->df) ."
"; + } else { + print $db->error(); + } + /* + * + * Liste des projets associés + * + */ + $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; + $sql .= " FROM llx_projet as p WHERE p.fk_soc = $objsoc->idp"; + if ( $db->query($sql) ) { + print ""; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) { + $tag = !$tag; print ""; + print ""; + } + while ($i < $num && $i < 5) { + $obj = $db->fetch_object( $i); + $tag = !$tag; + print ""; + print ''; + + print ""; + $i++; + } + $db->free(); + print "
idp\">liste des projets ($num)
'.$obj->title.'".strftime("%d %b %Y", $obj->do) ."
"; + } else { + print $db->error(); + } + + /* + * + * + */ + print "
\n"; + /* + * + * + * + */ + if ($action == 'changevalue') { + + print "
"; + print "
idp\" method=\"post\">"; + print ""; + print "Cette société est un cabinet de recrutement : "; + print ""; + print ""; + print "
\n"; + } else { + /* + * + * Liste des contacts + * + */ + print ""; + + print ""; + print ''; + print ""; + print ""; + + $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec"; + $result = $db->query($sql); + $i = 0 ; $num = $db->num_rows(); $tag = True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + if ($tag) { + print ""; + } else { + print ""; + } + print ""; + print ""; + print ''; + print ""; + print ''; + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + print "
Prénom NomPosteTélFaxEmailidp&action=addcontact\">Ajouter
$obj->firstname $obj->name"; + if ($obj->note) { + print "
".nl2br($obj->note); + } + print "
$obj->poste '.$obj->phone.' $obj->fax '.$obj->email.' idp&action=editcontact&contactid=$obj->idp\">Modifier
"; + + + print "\n
\n"; + /* + * + */ + print "\n
\n"; + /* + * + * Liste des statuts commerciaux + * + */ + $limliste = 5 ; + print "\n"; + + $sql = "SELECT a.id, ".$db->pdate("a.datel")." as da, c.libelle, a.author "; + $sql .= " FROM socstatutlog as a, c_stcomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_statut ORDER by a.datel DESC"; + if ( $db->query($sql) ) { + $i = 0 ; $num = $db->num_rows(); $tag = True; + while ($i < $num && $i < $limliste) { + $obj = $db->fetch_object( $i); + if ($tag) { + print ""; + } else { + print ""; + } + print ""; + print ""; + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + $db->free(); + if ($num > $limliste) { + print ""; + } + } else { + print $db->error(); + } + print "
". strftime("%d %b %Y %H:%M", $obj->da) ."$obj->libelle$obj->author
suite ...
"; + + print "
"; + /* + * + * Listes des actions + * + */ + $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.author, a.propalrowid "; + $sql .= " FROM actioncomm as a, c_actioncomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_action ORDER BY a.datea DESC, a.id DESC"; + if ( $db->query($sql) ) { + print "\n"; + print ''; + + $i = 0 ; $num = $db->num_rows(); $tag = True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + if ($tag) { + print ""; + } else { + print ""; + } + print ""; + + if ($obj->propalrowid) { + print ""; + } else { + print ""; + } + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + print "
Actions
". strftime("%d %b %Y %H:%M", $obj->da) ."propalrowid\">$obj->libelle$obj->libelle$obj->author
"; + + $db->free(); + } else { + print $db->error(); + } + print "
"; + /* + * Note sur la societe + */ + + print ''; + print ""; + print "
".nl2br($objsoc->note)."
"; + + /* + * + * Offres + * + */ + $sql = "SELECT o.idp, o.titre, "; + $sql .= $db->pdate("o.datea")." as da, ".$db->pdate("o.dated")." as dd,"; + $sql .= $db->pdate("o.datec")." as dc,o.active,o.deacmeth, o.site FROM offre as o"; + $sql .= " WHERE o.fk_soc = $objsoc->idp AND o.created =1"; + $sql .= " ORDER BY o.datea DESC"; + + $result = $db->query($sql); + $num = $db->num_rows(); + $i = 0; + + if ($num > 0) + { + + $bc1="bgcolor=\"#c0f0c0\""; + $bc3="bgcolor=\"#90c090\""; + $bc2="bgcolor=\"#b0e0b0\""; + + print "

"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $objo = $db->fetch_object( $i); + $var=!$var; + + if (!$var) { + $bc=$bc1; + } else { + $bc=$bc2; + } + if ($objo->active < -2) { + $bc = $bc3; + } + + print ""; + print ""; + print ""; + print ""; + if ($objo->active == 1) { + print ""; + } else { + print ""; + } + print "\n"; + print ""; + print ""; + if ($objo->active <> -2) { + print ""; + } else { + print ""; + } + if ($objo->active == -3) { + print ""; + } else { + print ""; + } + + print "\n"; + $i++; + } + print "
$numIDPSiteStatutTitreCrééeActivéeDatedMeth
" . ($i + 1 + ($limit * $page)) . "$objo->idp$objo->site" . $active["$objo->active"] ."" . $active["$objo->active"] ."idp\">$objo->titre" . strftime("%d %b %Y", $objo->dc) . "" . strftime("%d %b %Y", $objo->da) . "" . strftime("%d %b %Y", $objo->dd) . " ".$deacmeth[$objo->deacmeth]." 
"; + } + /* + * + * + * + */ + print "


"; + print "
idp\" method=\"post\">"; + print ""; + + $strmonth[1] = "Janvier"; + $strmonth[2] = "Février"; + $strmonth[3] = "Mars"; + $strmonth[4] = "Avril"; + $strmonth[5] = "Mai"; + $strmonth[6] = "Juin"; + $strmonth[7] = "Juillet"; + $strmonth[8] = "Août"; + $strmonth[9] = "Septembre"; + $strmonth[10] = "Octobre"; + $strmonth[11] = "Novembre"; + $strmonth[12] = "Décembre"; + + $smonth = 1; + $syear = date("Y", time()); + print "A recontacter : "; + print ""; + $cmonth = date("n", time()); + print ""; + + print ""; + print ""; + print "
\n"; + + /* + * + * Listes des actions + * + */ + $sql = "SELECT ".$db->pdate("sc.datec")." as da, sc.fk_cand "; + $sql .= " FROM soccontact as sc WHERE sc.fk_soc = $objsoc->idp ORDER BY sc.datec DESC"; + $result = $db->query($sql); + $num = $db->num_rows(); + if ($num > 0) + { + $tag = True; + $i = 0 ; + + print "
"; + print "Contacts
"; + print ""; + + while ($i < $num) { + $obj = $db->fetch_object( $i); + if ($tag) { + print ""; + } else { + print ""; + } + print ""; + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + print "
dateCandidat
". strftime("%d %b %Y %H:%M", $obj->da) ."$obj->fk_cand
"; + print "
"; + print "Description de la société
$objsoc->description"; + print "
"; + + } + } + } +} else { + /* + * Mode Liste + * + * + * + */ + + $bc[1]="bgcolor=\"#90c090\""; + $bc[0]="bgcolor=\"#b0e0b0\""; + + $sql = "SELECT s.idp, s.nom, cabrecrut,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.c_nom,s.c_prenom,s.c_tel,s.c_mail, s.cjn,st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.datea IS NOT NULL"; + + if (strlen($stcomm)) { + $sql .= " AND s.fk_stcomm=$stcomm"; + } + + if (strlen($begin)) { + $sql .= " AND upper(s.nom) like '$begin%'"; + } + + if ($aclasser==1) { + $sql .= " AND cabrecrut is null"; + } + + if ($coord == 1) { + $sql .= " AND view_res_coord=1"; + } + + if ($socname) { + $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; + $sortfield = "lower(s.nom)"; + $sortorder = "ASC"; + } + + $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + $i = 0; + + if ($sortorder == "DESC") { + $sortorder="ASC"; + } else { + $sortorder="DESC"; + } + print "

"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
IdSocieteContactemailStatut   
$obj->idpidp\">$obj->nom$obj->c_nom $obj->c_prenom$obj->c_mail$obj->stcomm$obj->prefix_comm idp&action=create\">[Propal]idp&action=add\">[Ventes]
"; + $db->free(); + } else { + print $db->error(); + } +} +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/comm/pre.inc.php3 b/htdocs/comm/pre.inc.php3 new file mode 100644 index 00000000000..cb245ef8835 --- /dev/null +++ b/htdocs/comm/pre.inc.php3 @@ -0,0 +1,151 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +$root = "/$PREFIX"; + +require ("/$GLJ_WWW_ROOT/conf/$GLJ_PREFIX.$GLJ_COUNTRY.inc.php3"); +require ("/$GLJ_WWW_ROOT/../www/lib/db.lib.php3"); +require("../main.inc.php3"); + +function llxHeader($head = "", $urlp = "") { + global $PREFIX, $user; + + print "\n$head\n\n"; + ?> + + \n"; + print ""; + + print "" . $GLOBALS["MAIN_TITLE"] . ""; + print "Technique"; + print "Commercial"; + print "Compta"; + print "Stats"; + print "\n"; + + print ""; + print ""; + + + print ""; + /* + * + */ + print "
"; + + print ""; + print ""; + print ""; + + + print ""; + /* + * + */ + print ""; + /* + * + */ + print ""; + + print ""; + + + print ""; + + print ""; + + print "
"; + print "
" . $GLOBALS["dbname"] . " - " . $user->code ."
"; + print "Accueil
"; + print "Bookmark"; + print "
"; + + print "
Societe
\n"; + print "A contacter
\n"; + print "Jamais contactée
\n"; + print "Ne pas contacter
\n"; + print "Contact en cours
\n"; + print "Contactée

\n"; + print "A relancer
\n"; + print "A recontacter
\n"; + print "A classer

\n"; + + print "Gourmands
\n"; + print "Contact
\n"; + print "

"; + print "\n"; + print "Factures
\n"; + print "Propal FE
\n"; + print "Clôture

\n"; + print "

"; + print "\n"; + print "Recap
\n"; + print "
"; + + print "Factures
\n"; + print "
Ventes
\n"; + print "Par sociétés
\n"; + print "Produits
\n"; + + print "
"; + print "Projets
\n"; + print "
"; + print "Stats
\n"; + print "
"; + print "
Societes
\n"; + print "
"; + print ''; + print ''; + print ' '; + print ""; + print "
"; + + print "
Contacts
\n"; + print "
"; + print ''; + print ''; + print " "; + print ""; + print "
"; + + + print "
"; + print "Soc : "; + print ""; + print "
"; + print "
"; + + print "
\n"; +} + +function llxFooter($foot='') { + print "
\n"; + print "$foot"; +} +/* + * $Id$ + * $Source$ + */ +?> diff --git a/htdocs/comm/projet/fiche.php3 b/htdocs/comm/projet/fiche.php3 new file mode 100644 index 00000000000..e678c72b6ec --- /dev/null +++ b/htdocs/comm/projet/fiche.php3 @@ -0,0 +1,136 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +require("./pre.inc.php3"); +require("../../lib/functions.inc.php3"); +require("./project.class.php3"); +require("../propal.class.php3"); + +llxHeader("","../"); +print ""; +print ""; + +print "
Projets
"; + +$bc[0]="bgcolor=\"#90c090\""; +$bc[1]="bgcolor=\"#b0e0b0\""; + +$db = new Db(); + +if ($sortfield == "") { + $sortfield="lower(p.label)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + +$yn["t"] = "oui"; +$yn["f"] = "non"; + +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + + +if ($action == 'create') { +?> + +

+ + + +'; +?> + + + +
Société +'; ?> +
Créateur'.$user->fullname.'
Ref
Titre
+
+fetch($db, $id); + + print ''; + print ''; + + print ''; + print ''; + print '
Société
Ref'.$projet->ref.'
Titre'.$projet->title.'
'; + + $propales = $projet->get_propal_list($db); + + if (sizeof($propales)>0 && is_array($propales)) { + + print '

Listes des propales associées au projet'; + print ''; + + print ""; + print ""; + print ''; + print ''; + print ''; + print ''; + + for ($i = 0; $ifetch($db, $propales[$i]); + + $var=!$var; + print ""; + print "\n"; + + print ''; + + print ''; + print ''; + print ''; + + $total = $total + $propale->price; + } + + print ''; + print ''; + print ''; + print ''; + + print "
RéfDatePrixStatut
id\">$propale->ref'.strftime("%d %B %Y",$propale->datep).''.price($propale->price).'statut
'.$i.' propalesSoit : '.francs($total).' FF HTTotal : '.price($total).'Euros HT
"; + + + } else { + print "pas de propales"; + } + + +} + + + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/comm/projet/index.php3 b/htdocs/comm/projet/index.php3 new file mode 100644 index 00000000000..b635dd6c444 --- /dev/null +++ b/htdocs/comm/projet/index.php3 @@ -0,0 +1,126 @@ + + * + * $Id$ + * $Source$ + */ +require("./pre.inc.php3"); +require("../../lib/functions.inc.php3"); +require("./project.class.php3"); + + +llxHeader("","../"); +print ''; +print ''; +if($socidp) { + print ''; +} +print '
Projets[Nouveau projet]
'; + +$bc[0]="bgcolor=\"#90c090\""; +$bc[1]="bgcolor=\"#b0e0b0\""; + +$db = new Db(); +/* + * Traitements des actions + * + */ +if ($action == 'create') { + + $pro = new Project(); + $pro->socidp = $socidp; + $pro->ref = $ref; + $pro->title = $title; + + $pro->create($db, $user->id); +} + + + +/* + * + * Affichage + * + */ +if ($sortfield == "") { + $sortfield="lower(p.label)"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + +$yn["t"] = "oui"; +$yn["f"] = "non"; + +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + + +/* + * + * + * Liste des projets + * + * + */ + +print "

"; +$sql = "SELECT s.nom, s.idp, p.rowid as projectid, p.ref, p.title,".$db->pdate("p.dateo")." as do"; +$sql .= " FROM societe as s, llx_projet as p"; +$sql .= " WHERE p.fk_soc = s.idp"; + +if ($socidp) { $sql .= " AND s.idp = $socidp"; } + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + print "

"; + + $oldstatut = -1; + $subtotal = 0; + while ($i < $num) { + $objp = $db->fetch_object( $i); + + if ($objp->statut <> $oldstatut ) { + $oldstatut = $objp->statut; + + if ($i > 0) { + print "\n"; + print "\n"; + } + $subtotal = 0; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $var=True; + } + + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print ""; + print "\n"; + + $i++; + } + + print "
Total : ".price($subtotal)."Euros HT
[Tous]SocieteRéfTitreDateStatut [statutid\">Filtre]
[idp\">Filtre]idp\">$objp->nomprojectid\">$objp->refprojectid\">$objp->title 
"; + $db->free(); +} else { + print $db->error(); +} + +$db->close(); +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/comm/projet/pre.inc.php3 b/htdocs/comm/projet/pre.inc.php3 new file mode 100644 index 00000000000..fab3b5e8c08 --- /dev/null +++ b/htdocs/comm/projet/pre.inc.php3 @@ -0,0 +1,118 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +$root = "/$PREFIX"; + +require ("/$GLJ_WWW_ROOT/conf/$GLJ_PREFIX.$GLJ_COUNTRY.inc.php3"); +require ("/$GLJ_WWW_ROOT/../www/lib/db.lib.php3"); +require ("../../main.inc.php3"); + +function llxHeader($head = "", $urlp = "") { + global $PREFIX, $user; + + print "\n$head\n\n"; + ?> + + \n"; + print ""; + + print "" . $GLOBALS["MAIN_TITLE"] . ""; + print "Technique"; + print "Commercial"; + print "Compta"; + print "Stats"; + print "\n"; + + print ""; + print ""; + + + print ""; + /* + * + */ + print "
"; + + print ""; + print ""; + /* + * + */ + print ""; + /* + * + */ + print ""; + + print ""; + + print "
"; + print "
" . $GLOBALS["dbname"] . " - " . $user->code ."
"; + print "Accueil
"; + print "Bookmark"; + print "
"; + print "\n"; + print "Recap
\n"; + print "
"; + + print "Factures
\n"; + + print "Produits
\n"; + + print "
"; + print "
Societes
\n"; + print "
"; + print ''; + print ''; + print ' '; + print ""; + print "
"; + + print "
Contacts
\n"; + print "
"; + print ''; + print ''; + print " "; + print ""; + print "
"; + + + print "
"; + print ""; + print ""; + print "
"; + print "
"; + + print "
\n"; +} + +function llxFooter($foot='') { + print "
\n"; + print "$foot"; +} +/* + * $Id$ + * $Source$ + */ +?> diff --git a/htdocs/comm/projet/project.class.php3 b/htdocs/comm/projet/project.class.php3 new file mode 100644 index 00000000000..8e048fc0c2b --- /dev/null +++ b/htdocs/comm/projet/project.class.php3 @@ -0,0 +1,108 @@ + + * + * $Id$ + * $Source$ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +class Project { + var $id; + var $ref; + var $title; + var $socidp; + + Function Project() { + + } + /* + * + * + * + */ + + Function create($db, $creatorid) { + + $sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat) "; + $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;"; + + if (!$db->query($sql) ) + { + print ''.$sql.'
'.$db->error(); + + } + + } + /* + * + * + * + */ + + Function fetch($db, $rowid) { + + $sql = "SELECT title, ref FROM llx_projet WHERE rowid=$rowid;"; + + if ($db->query($sql) ) { + if ($db->num_rows()) { + $obj = $db->fetch_object(0); + + $this->id = $rowid; + $this->ref = $obj->ref; + $this->title = $obj->title; + + $db->free(); + } + } else { + print $db->error(); + } + } + /* + * + * + * + */ + Function get_propal_list($db) { + $propales = array(); + $sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;"; + + if ($db->query($sql) ) { + $nump = $db->num_rows(); + if ($nump) { + $i = 0; + while ($i < $nump) { + $obj = $db->fetch_object($i); + + $propales[$i] = $obj->rowid; + + $i++; + } + $db->free(); + /* + * Retourne un tableau contenant la liste des propales associees + */ + return $propales; + } + } else { + print $db->error() . '
' .$sql; + } + + + } +} +?>