|
noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
|
Handle the ledger of purchase,. More...
Inheritance diagram for Acc_Ledger_Purchase:
Collaboration diagram for Acc_Ledger_Purchase:Public Member Functions | |
| __construct ($p_cn, $p_init) | |
| construct | |
| confirm ($p_array, $p_summary=false) | |
| show the summary of the operation and propose to save it | |
| input ($p_array=null, $p_readonly=0) | |
| display the form for entering data for invoice | |
| insert ($p_array=null) | |
| insert into the database, it calls first the verify function change the value of this->jr_id and this->jr_internal. It generates the document and save the middle of payment, if 'gen_invoice is set and e_mp | |
| verify_operation ($p_array) | |
| verify that the data are correct before inserting or confirming | |
Public Member Functions inherited from Acc_Ledger | |
| add_card ($p_filter, $p_id_update) | |
| Return a button to create new card, depending of the ledger. | |
| button_copy_operation () | |
| Show a button to create an operation identical to the recorded one. | |
| button_new_operation () | |
| Create a button to encode a new operation into the same ledger. | |
| check_currency ($p_qcode_payment, $p_currency_id) | |
| When we write a record for the payment at the same time as a sale or a purchase, to have a bank saldo reliable , all the bank operation must be in the same currency Operation = Currency 1 and Bank = Currency 2 then it must failed , except if currency 2 (of the bank is the default currency. | |
| check_currency_setting ($p_currency_code) | |
| Check that the currency code does exist and the setting of the folder is correct. | |
| check_payment ($e_mp, $e_mp_qcode) | |
| check if the payment method is valid | |
| check_periode () | |
| Check if a Dossier is using the check on the periode, if true than the user has to enter the date and the periode, it is a security check. | |
| check_strict () | |
| Check if a Dossier is using the strict mode or not. | |
| compute_internal_code ($p_grpt) | |
| compute the internal code of the saved operation and set the $this->jr_internal to the computed value | |
| convert_from_follow ($p_ag_id, $copy_description=0) | |
| convert operations from FOLLOWUP into a SALE , FEENOTE or PURCHASE operation into a suitable array | |
| create_document ($internal, $p_array) | |
| create the invoice and saved it as attachment to the operation, | |
| CurrencyInput ($p_currency_code, $p_currency_rate, $p_eur_amount) | |
| Create a select from value for currency and add javascript to update $p_currency_rate and $p_eur_amount. | |
| delete () | |
| let you delete a operation | |
| delete_ledger () | |
| delete a ledger IF it doesn't contain anything | |
| display_additional_tax ($p_additional_tax, $p_amount) | |
| in confirm screen , display the compute value for additional tax @parameter $p_additional_tax acc_other_tax.ac_id | |
| display_ledger () | |
| display detail of a ledger | |
| display_negative_warning ($p_amount) | |
| If the amount is positive and the ledger expects a negative amount, il will return the saved warning. | |
| display_warning ($pa_msg, $p_warning) | |
| Display warning contained in an array. | |
| existing_vat () | |
| return the used VAT code with a rate > 0 | |
| get_all_fiche_def () | |
| retrieve all the card for this type of ledger, make them into a string separated by comma | |
| get_class_def () | |
| retrieve the jrn_def_class_deb and return it | |
| get_currency () | |
| returns the code iso of the default currency for this ledger | |
| get_customer_late () | |
| get info from customer not yet paid | |
| get_customer_now () | |
| get info from customer to pay today | |
| get_default_card ($p_ledger_type, $p_side) | |
| Return an array of default card for the ledger type given. | |
| get_fiche_def () | |
| retrieve the jrn_def_fiche and return them into a array index deb, cred | |
| get_first ($p_type, $p_access=3) | |
| get the first ledger | |
| get_id ($p_internal) | |
| retrieve the jr_id thanks the internal code, do not change anything to the current object | |
| get_is_loaded () | |
| get_last ($p_limit) | |
| return the last p_limit operation into an array | |
| get_last_date () | |
| get the date of the last operation | |
| get_last_pj () | |
| returns the sequence number of the receipt for the current ledger or create the sequence if it doesn't exist | |
| get_ledger_id () | |
| Set the jrn_def.jrn_def_id. | |
| get_min_row () | |
| get_name () | |
| Return the name of a ledger. | |
| get_operation ($p_from, $p_to) | |
| retrieve operation from jrn | |
| get_operation_date ($p_date, $p_ledger_type, $sql_op) | |
| Get operation from the ledger type before, after or with the given date . | |
| get_other_amount ($p_jr_id) | |
| get the amount of vat for a given jr_grpt_id from the table quant_purchase | |
| get_propertie () | |
| Get the properties of a journal. | |
| get_rowSimple ($p_from, $p_to, $pa_ledger=[], $trunc=0, $p_limit=-1, $p_offset=-1) | |
| Get simplified row from ledger Call Acc_Ledger_History_Generic:get_rowSimple. | |
| get_solde ($p_from, $p_to) | |
| get the saldo of a ledger for a specific period | |
| get_supplier_late () | |
| get info from supplier not yet paid | |
| get_supplier_now () | |
| get info from supplier to pay today | |
| get_tiers ($p_jrn_type, $jr_id) | |
| Retrieve the third : supplier for purchase, customer for sale, bank for fin,. | |
| get_tiers_id ($p_jrn_type, $jr_id) | |
| Return the f_id of the tiers , called by get_tiers. | |
| get_type () | |
| Return the type of a ledger (ACH,VEN,ODS or FIN) or GL. | |
| guess_pj () | |
| guess what the next pj should be | |
| has_other_tax () | |
| returns true if the ledger has an additional tax | |
| has_quantity () | |
| Check if a ledger is enabled , 1 for yes and 0 if disabled. | |
| inc_seq_pj () | |
| increment the sequence for the pj | |
| input_additional_tax () | |
| form : display additional tax available for this ledger and value, set 2 values : checkbox if tax applies and value | |
| input_extra_info () | |
| input_new () | |
| display FORM to enter parameters to create a new ledger. | |
| input_paid ($p_selected, $p_amount=0, $p_date="", $p_comm="") | |
| Create the section payment. | |
| is_closed ($p_periode) | |
| check if the current ledger is closed | |
| is_enable () | |
| Check if a ledger is enabled , 1 for yes and 0 if disabled. | |
| listing () | |
| listing of all ledgers | |
| previous_amount ($p_to) | |
| retrieve amount of previous periode | |
| previous_other_tax ($p_to) | |
| retrieve the previous amount | |
| reverse ($p_date, $p_label) | |
| reverse the operation by creating the opposite one, the result is to avoid it it must be done in | |
| save ($p_array=null) | |
| save the operation into the jrnx,jrn, , CA and pre_def | |
| save_followup ($s_related_action) | |
| attach action-followups to an operation, | |
| save_new ($array) | |
| Insert a new ledger , member variable like jrn_def_id will changed. | |
| search_group ($p_what, $p_value) | |
| retreive the jr_grpt_id from a ledger | |
| select_default_currency () | |
| create a select button to set the default currency for a ledger used only for empty financial ledger | |
| select_depot ($p_readonly, $p_repo) | |
| Let you select the repository before confirming a sale or a purchase. | |
| select_ledger ($p_type="ALL", $p_access=3, $enable=TRUE) | |
| Show a select list of the ledgers you can access in writing, reading or simply accessing. | |
| set_currency_id () | |
| retrieve currency_id from database | |
| set_is_loaded ($is_loaded) | |
| set_ledger_id ($p_id) | |
| Set the jrn_def.jrn_def_id. | |
| set_quantity ($p_value) | |
| set quantity for the ledger to 1 or 0, | |
| update ($array=null) | |
| update a ledger | |
| update_internal_code ($p_internal) | |
| update_paid ($p_array) | |
| Update the paiment in the list of operation. | |
| use_quant_table ($p_grpt_id, $p_jrn_type) | |
| Check if the operation is used in the table quant*. | |
| vat_operation ($p_jr_id) | |
| get the amount of vat for a given jr_grpt_id from the table quant_purchase | |
| verify_ledger ($array) | |
| Verify before update. | |
Private Member Functions | |
| compute_no_deductible (Acc_Compute $p_nd_amount, Fiche $p_fiche) | |
| Compute the ND amount thanks the attribute of the concerned card. | |
| insert_no_deductible (Acc_Compute $p_nd_amount, Fiche $p_fiche, $p_tva_both, &$p_tot_debit, Acc_Operation $p_acc_operation, $p_group, $idx) | |
| Insert into JRNX the No Deductible amount and into Analytic Accountancy for the ND VAT. | |
Private Attributes | |
| $payment_operation | |
Additional Inherited Members | |
Static Public Member Functions inherited from Acc_Ledger | |
| static | array_cat () |
| create an array of the existing cat, to be used in a checkbox form | |
| static | next_number ($p_cn, $p_type) |
| retrieve the next number for this type of ledger | |
| static | test_me ($pCase='') |
| this function is intended to test this class | |
Data Fields inherited from Acc_Ledger | |
| $currency_id | |
| !< default number of rows by default 10 | |
| $db | |
| !< jrn_def.jrn_def_id | |
| $id | |
| $ledger_type | |
| !< row of the ledger | |
| $nb | |
| !< type of the ledger ACH ODS FIN VEN or GL | |
| $row | |
| !< database connextion | |
Protected Member Functions inherited from Acc_Ledger | |
| find_label ($p_value) | |
| Retrieve the label of an accounting. | |
| verify_autonumber ($p_array) | |
| compare given receipt number and suggested one, if different , it means that the user enters a receipt number if e_pj or e_pj_suggest is not set or empty , or if both are equals then will return true, it returns only if they exist and are different | |
| warn_manual_receipt ($p_array) | |
| warn if the suggested receipt and receipt are different , it means that the user tried to number himself | |
Protected Attributes inherited from Acc_Ledger | |
| $is_loaded | |
| !< is_loaded true the ledger definition is loaded or false, it is not | |
Handle the ledger of purchase,.
Definition at line 36 of file acc_ledger_purchase.class.php.
| Acc_Ledger_Purchase::__construct | ( | $p_cn, | |
| $p_id ) |
construct
| $p_cn | database connexion |
| $p_id | jrn.jrn_def_id |
Reimplemented from Acc_Ledger.
Definition at line 40 of file acc_ledger_purchase.class.php.
|
private |
Compute the ND amount thanks the attribute of the concerned card.
The object $p_nd_amount will changed
| Acc_Compute | $p_nd_amount | object with ND amount |
| Fiche | $p_fiche | Concerned Card (purchase items) |
| type | $p_tva_bot | 0 TVA on one side, 1 TVA on both side |
Definition at line 304 of file acc_ledger_purchase.class.php.
References ATTR_DEF_DEP_PRIV, ATTR_DEF_DEPENSE_NON_DEDUCTIBLE, ATTR_DEF_TVA_NON_DEDUCTIBLE, ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP, Acc_Compute\compute_nd(), Acc_Compute\compute_nd_vat(), Acc_Compute\compute_ndded_vat(), Acc_Compute\compute_perso(), Fiche\empty_attribute(), and Fiche\strAttribut().
Referenced by insert().
Here is the call graph for this function:| Acc_Ledger_Purchase::confirm | ( | $p_array, | |
| $p_summary = false ) |
show the summary of the operation and propose to save it
| array | contains normally $_POST. It proposes also to save the Analytic accountancy |
| $p_summary | true to confirm false, show only the result in RO |
Payment method
the function extra info allows to
Retrieve data from the view v_detail_purchase
| $p_from | jrn.jr_tech_per from |
| $p_end | jrn.jr_tech_per to |
compute an array with the heading cells for the details, used for the export in CSV
Reimplemented from Acc_Ledger.
Definition at line 1575 of file acc_ledger_purchase.class.php.
References $acompte, $amount, $anc, $date_limit, $default_currency, $e_date, $fiche, $g_parameter, $g_user, $i, $jr_id, $jrn_type, $op, $other_tax_amount, $p_array, $p_jrn, $r, $span, $str_code, $tot, $tot_amount, $value, _, ATTR_DEF_ACCOUNT, ATTR_DEF_ADRESS, ATTR_DEF_CITY, ATTR_DEF_CP, ATTR_DEF_NAME, Acc_Tva\build(), Acc_Ledger\check_periode(), cn, db, Acc_Ledger\display_negative_warning(), Acc_Ledger\get_name(), h, Acc_Ledger\has_other_tax(), hb(), Anc_Plan\hidden(), Icon_Action\infobulle(), nbm(), noalyss_strlentrim(), span(), td(), tr(), UPDRECEIPT, and Acc_Ledger\warn_manual_receipt().
Here is the call graph for this function:| Acc_Ledger_Purchase::input | ( | $p_array = null, | |
| $p_readonly = 0 ) |
display the form for entering data for invoice
| $p_array | is null or you can put the predef operation or the $_POST array
'sa' => string 'n' (length=1)
'p_action' => string 'ach' (length=3)
'gDossier' => string '28' (length=2)
'e_client' => string 'ASEKURA' (length=7)
'nb_item' => string '9' (length=1)
'p_jrn' => string '3' (length=1)
'period' => string '126' (length=3)
'e_comm' => string 'descriptio' (length=10)
'e_date' => string '01.05.2010' (length=10)
'e_ech' => string '' (length=0)
'jrn_type' => string 'ACH' (length=3)
'e_pj' => string 'ACH37' (length=5)
'e_pj_suggest' => string 'ACH37' (length=5)
'mt' => string '1273759434.5701' (length=15)
'e_mp' => string '0' (length=1)
'e_march0' => string 'DOC' (length=3)
'e_march0_price' => string '2000' (length=4)
'e_march0_tva_id' => string '3' (length=1)
'e_march0_tva_amount' => string '120' (length=3)
'e_quant0' => string '1' (length=1)
'gen_invoice' => string 'on' (length=2)
'gen_doc' => string '7' (length=1)
'bon_comm' => string '' (length=0)
'other_info' => string '' (length=0)
'correct' => string 'Corriger' (length=8)
|
Reimplemented from Acc_Ledger.
Definition at line 1184 of file acc_ledger_purchase.class.php.
References $array, $currency, Acc_Ledger\$db, $def, $e, $e_date, $fiche, $g_parameter, $g_user, $http, $i, $label, $op, $oPeriode, $p_array, $p_readonly, $periode, $r, $url, $wLedger, _, Acc_Ledger\add_card(), ATTR_DEF_ADRESS, ATTR_DEF_CITY, ATTR_DEF_CP, ATTR_DEF_NAME, ATTR_DEF_TVA, Acc_Ledger\check_periode(), create_script(), Acc_Ledger\CurrencyInput(), db, FICADD, Acc_Ledger\get_min_row(), Acc_Ledger\guess_pj(), Icon_Action\infobulle(), Acc_Ledger\input_additional_tax(), Html_Input_Noalyss\ledger_add_item(), noalyss_strlentrim(), OPEN, record_log(), Acc_Ledger\select_ledger(), td(), and UPDRECEIPT.
Here is the call graph for this function:| Acc_Ledger_Purchase::insert | ( | $p_array = null | ) |
insert into the database, it calls first the verify function change the value of this->jr_id and this->jr_internal. It generates the document and save the middle of payment, if 'gen_invoice is set and e_mp
| $p_array | is usually $_POST or a predefined operation Array
(
[e_client] =>BELGACOM
[nb_item] =>9
[p_jrn] =>3
[period] =>117
[e_comm] =>Frais de téléphone
[e_date] =>01.09.2009
[e_ech] =>
[jrn_type] =>ACH
[e_pj] =>ACH53
[e_pj_suggest] =>ACH53
[mt] =>1265318941.39
[e_mp] =>0
[e_march0] =>TEL
[e_march0_price] =>63.6700
[e_march0_tva_id] =>1
[e_march0_tva_amount] =>13.3700
[e_quant0] =>1.000
...
[bon_comm] =>
[other_info] =>
[record] =>Enregistrement
[p_currency_code]=> id currency
[p_currency_rate]=>rate used
)
|
= e_pj then do not increment sequence , if the given receipt number is equal to one computed then increment
Definition at line 518 of file acc_ledger_purchase.class.php.
References $_POST, $acompte, $array, $check_periode, $e, $e_date, $fiche, $g_parameter, $g_user, $i, $j_id, $ledger, $op, $oPeriode, $other_tax_amount, $p_array, $p_jrn, $poste, $prop, $r, $repo, $Res, Acc_Ledger\$row, $seq, $str_file, $tot_amount, $value, _, ATTR_DEF_ACCOUNT, ATTR_DEF_QUICKCODE, Acc_Tva\build(), Acc_Operation_Note\build_jrn_id(), Acc_Ledger\check_periode(), Acc_Ledger\compute_internal_code(), compute_no_deductible(), Acc_Ledger\create_document(), db, EXC_BALANCE, Acc_Ledger\get_id(), h, Acc_Ledger\has_other_tax(), Acc_Ledger\inc_seq_pj(), Stock_Goods\insert_goods(), insert_no_deductible(), jr_id, noalyss_strlentrim(), record_log(), sql_string(), and Acc_Ledger\update_internal_code().
Here is the call graph for this function:
|
private |
Insert into JRNX the No Deductible amount and into Analytic Accountancy for the ND VAT.
| Acc_Compute | $p_nd_amount | content ND amount |
| Fiche | $p_fiche | Card of the Service |
| type | $p_tva_both | 0 if TVA is normal or 1 if on both side |
| type | $p_tot_debit | total debit |
| $p_acc_operation | Acc_Operation for inserting into jrnx | |
| $p_group | group for AC | |
| $idx | row number |
Definition at line 342 of file acc_ledger_purchase.class.php.
References $_POST, $g_parameter, $idx, $j_id, $op, ATTR_DEF_ACCOUNT, ATTR_DEF_ACCOUNT_ND, ATTR_DEF_ACCOUNT_ND_PERSO, ATTR_DEF_ACCOUNT_ND_TVA, ATTR_DEF_ACCOUNT_ND_TVA_ND, ATTR_DEF_QUICKCODE, db, Fiche\empty_attribute(), Acc_Ledger\find_label(), Acc_Operation\insert_jrnx(), sql_string(), and Fiche\strAttribut().
Referenced by insert().
Here is the call graph for this function:| Acc_Ledger_Purchase::verify_operation | ( | $p_array | ) |
verify that the data are correct before inserting or confirming
| an | array (usually $_POST) |
| Exception | if an error occurs |
we have to check also if the different accountings exist "ATTR_DEF_DEP_PRIV" "ATTR_DEF_DEPENSE_NON_DEDUCTIBLE" "ATTR_DEF_TVA_NON_DEDUCTIBLE" "ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP"
Reimplemented from Acc_Ledger.
Definition at line 52 of file acc_ledger_purchase.class.php.
References $a, $a_poste, $array, $e_date, $fiche, $g_parameter, $g_user, $i, $max, $min, Acc_Ledger\$nb, $oPeriode, $p_array, $p_jrn, $periode, $poste, $tva_rate, _, ATTR_DEF_ACCOUNT, ATTR_DEF_ACCOUNT_ND, ATTR_DEF_ACCOUNT_ND_PERSO, ATTR_DEF_ACCOUNT_ND_TVA, ATTR_DEF_ACCOUNT_ND_TVA_ND, ATTR_DEF_DEP_PRIV, ATTR_DEF_DEPENSE_NON_DEDUCTIBLE, ATTR_DEF_TVA_NON_DEDUCTIBLE, ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP, Acc_Tva\build(), Acc_Ledger\check_currency(), Acc_Ledger\check_currency_setting(), check_parameter(), Acc_Ledger\check_payment(), Acc_Ledger\check_periode(), Acc_Ledger\check_strict(), cmpDate(), cn, db, Acc_Ledger\get_last_date(), h, Acc_Ledger\is_closed(), isDate(), isNumber(), and noalyss_strlentrim().
Here is the call graph for this function:
|
private |
Definition at line 38 of file acc_ledger_purchase.class.php.