Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Document Class Reference

Class Document corresponds to the table document. More...


Public Member Functions

 Document ($p_cn, $p_d_id=0)
 Generate ()
 Generate the document, Call $this->Replace to replace tag by value.
 ParseDocument ($p_dir, $p_file)
 This function parse a document and replace all the predefined tags by a value. This functions generate diffent documents (invoice, order, letter) with the info from the database.
 SaveGenerated ($p_file)
 Save the generated Document.
 Upload ()
 Upload a file into document all the needed data are in $_FILES we don't increment the seq.
 a_ref ()
 create and compute a string for reference the doc <A ...>
 Get ()
 Replace ($p_tag)
 replace the TAG by the real value, this value can be into the database or in $_POST The possible tags are
  • [CUST_NAME] customer's name
  • [CUST_ADDR_1] customer's address line 1
  • [CUST_CP] customer's ZIP code
  • [CUST_CO] customer's country
  • [CUST_VAT] customer's VAT
  • [MARCH_NEXT] end this item and increment the counter $i
  • [VEN_ART_NAME]
  • [VEN_ART_PRICE]
  • [VEN_ART_QUANT]
  • [VEN_ART_TVA_CODE]
  • [VEN_ART_TVA_AMOUNT]
  • [VEN_ART_STOCK_CODE]
  • [VEN_HTVA]
  • [VEN_TVAC]
  • [VEN_TVA]
  • [TOTAL_VEN_HTVA]
  • [DATE]
  • [NUMBER_ID]
  • [MY_NAME]
  • [MY_CP]
  • [MY_COMMUNE]
  • [MY_TVA]
  • [MY_STREET]
  • [MY_NUMBER]

 remove ()
 remove a row from the table document, the lob object is not deleted because can be linked elsewhere
 MoveDocumentPj ($p_internal)
 Move a document from the table document into the concerned row the document is not copied : it is only a link.

Data Fields

 $db
 $ag_id
 $d_mimetype
 $d_filename
 $d_lob
 $d_number
 $md_id


Detailed Description

Class Document corresponds to the table document.

Definition at line 27 of file class_document.php.


Constructor & Destructor Documentation

Document::Document p_cn,
p_d_id = 0
 

Definition at line 40 of file class_document.php.

Referenced by SaveGenerated().


Member Function Documentation

Document::a_ref  ) 
 

create and compute a string for reference the doc <A ...>

a_ref

Returns:
a string

Definition at line 284 of file class_document.php.

References $r.

Document::Generate  ) 
 

Generate the document, Call $this->Replace to replace tag by value.

Parameters:
none 
Returns:
an array : the url where the generated doc can be found, the name of the file and his mimetype
Todo:
Carefull : the slash is not windows compliant

Definition at line 55 of file class_document.php.

References $Res, $ret, $row, Commit(), echo_debug(), ExecSql(), NextSequence(), ParseDocument(), SaveGenerated(), and StartSql().

Document::Get  ) 
 

Definition at line 295 of file class_document.php.

References $file, $ret, $row, $tmp, Commit(), ExecSql(), and StartSql().

Document::MoveDocumentPj p_internal  ) 
 

Move a document from the table document into the concerned row the document is not copied : it is only a link.

Parameters:
$p_internal internal code

Definition at line 602 of file class_document.php.

References $sql, and ExecSql().

Document::ParseDocument p_dir,
p_file
 

This function parse a document and replace all the predefined tags by a value. This functions generate diffent documents (invoice, order, letter) with the info from the database.

ParseDocument

Parameters:
$p_dir directory name
$p_file filename
Note:
Replace in the doc the tags by their values.
  • MY_* table parameter
  • ART_VEN* table quant_sold for invoice
  • CUST_* table quant_sold and fiche for invoice
  • e_* for the invoice in the $_POST

Definition at line 125 of file class_document.php.

References $h, echo_debug(), exit, Replace(), and value.

Referenced by Generate().

Document::remove  ) 
 

remove a row from the table document, the lob object is not deleted because can be linked elsewhere

Definition at line 591 of file class_document.php.

References $sql, and ExecSql().

Document::Replace p_tag  ) 
 

replace the TAG by the real value, this value can be into the database or in $_POST The possible tags are

  • [CUST_NAME] customer's name
  • [CUST_ADDR_1] customer's address line 1
  • [CUST_CP] customer's ZIP code
  • [CUST_CO] customer's country
  • [CUST_VAT] customer's VAT
  • [MARCH_NEXT] end this item and increment the counter $i
  • [VEN_ART_NAME]
  • [VEN_ART_PRICE]
  • [VEN_ART_QUANT]
  • [VEN_ART_TVA_CODE]
  • [VEN_ART_TVA_AMOUNT]
  • [VEN_ART_STOCK_CODE]
  • [VEN_HTVA]
  • [VEN_TVAC]
  • [VEN_TVA]
  • [TOTAL_VEN_HTVA]
  • [DATE]
  • [NUMBER_ID]
  • [MY_NAME]
  • [MY_CP]
  • [MY_COMMUNE]
  • [MY_TVA]
  • [MY_STREET]
  • [MY_NUMBER]

Parameters:
TAG 
Returns:
String which must replace the tag
Todo:
verify that price and quant are numeric
Todo:
carefull round problem ?
Todo:
verify that price and quant are numeric
Todo:
carefull round problem ?

Definition at line 363 of file class_document.php.

References $my, $qcode, $r, ag_date, break, fiche, GetTvaRate(), MY_COMMUNE, MY_CP, MY_NAME, MY_NUMBER, MY_STREET, MY_TVA, and qcode.

Referenced by ParseDocument().

Document::SaveGenerated p_file  ) 
 

Save the generated Document.

SaveGenerated

Parameters:
$p_file is the generated file
Returns:
0 if no error otherwise 1

Definition at line 200 of file class_document.php.

References $doc, $sql, Commit(), Document(), echo_debug(), ExecSql(), GetSequence(), Rollback(), and StartSql().

Referenced by Generate().

Document::Upload  ) 
 

Upload a file into document all the needed data are in $_FILES we don't increment the seq.

Upload

Returns:

Definition at line 231 of file class_document.php.

References $old_oid, $r, $ret, $sql, Commit(), ExecSql(), name, Rollback(), and StartSql().


Field Documentation

Document::$ag_id
 

action_gestion.ag_id (pk)

Definition at line 31 of file class_document.php.

Document::$d_filename
 

Definition at line 33 of file class_document.php.

Document::$d_lob
 

the oid of the lob

Definition at line 34 of file class_document.php.

Document::$d_mimetype
 

Definition at line 32 of file class_document.php.

Document::$d_number
 

number of the document

Definition at line 35 of file class_document.php.

Document::$db
 

Database connexion var $d_id; /*!

Definition at line 29 of file class_document.php.

Document::$md_id
 

document's template

Definition at line 36 of file class_document.php.


The documentation for this class was generated from the following file:
Generated on Sat Jun 24 20:41:35 2006 for phpcompta by  doxygen 1.4.4