.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "LedgerSMB::DBObject::Company 3pm" .TH LedgerSMB::DBObject::Company 3pm "2014-06-10" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" LedgerSMB::DBObject::Company \- Base utility functions for processing customers and vendors. .SH "SYNOPSIS" .IX Header "SYNOPSIS" This library contains the base utility functions for creating, saving, and retrieving customers and vendors. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$company\->\fIset_entity_class()\fR" 4 .el .IP "\f(CW$company\fR\->\fIset_entity_class()\fR" 4 .IX Item "$company->set_entity_class()" This is a stub for a private method that subclasses are expected to overwrite. It will be set to the account class of the entity (1 for vendor, 2 for customer, etc). .IP "get_by_cc" 4 .IX Item "get_by_cc" This retrieves the company header information by control code. Leaves the overall account class untouched. .IP "\fIsave()\fR" 4 .IX Item "save()" This stores the company record including a credit account in the database. .Sp \&\s-1TODO: \s0 Separate company from credit account storage. .IP "delete_contact" 4 .IX Item "delete_contact" required request variables: .Sp contact_class_id: int id of contact class contact: text of contact information .Sp Must include at least one of: .Sp credit_id: int of entity_credit_account.id, preferred value company_id: int of company.id, only used if credit_id not set. .Sp returns true of a record was deleted. .IP "delete_location" 4 .IX Item "delete_location" Deletes a record from the location side. .Sp Required request variables: .Sp location_id location_class_id .Sp One of: .Sp credit_id (preferred) company_id (as fallback) .Sp Returns true if a record was deleted. False otherwise. .IP "delete_bank_account" 4 .IX Item "delete_bank_account" Deletes a bank account .Sp Requires: .Sp entity_id bank_account_id .Sp Returns true if a record was deleted, false otherwise. .IP "get_history" 4 .IX Item "get_history" Retrieves customer/vendor purchase. .Sp Search Criteria name: search string for company name contact_info: Search string for contact info, can match phone, fax, or email. salesperson: Search string for employee name in the salesperson field notes: Notes search. Not currently implemented meta_number: Exact match for customer/vendor number address_line: Search string for first or second line of address. city: Search string for city name state: Case insensitive, otherwise exact match for state or province zip: leading match for zip/mail code country_id: integer for country id. Exact match tartdate_from: Earliest date for startdate of entity credit account startdate_to: Lates date for entity credit accounts' start date type: either 'i' for invoice, 'o' for orders, 'q' for quotations from_date: Earliest date for the invoice/order to_date: Latest date for the invoice/order .Sp Unless otherwise noted, partial matches are sufficient. .Sp Control variables: inc_open: Include open invoices/orders. If not true, no open invoices are displayed inc_closed: Include closed invoices/orders. If not true, no closed invoices are displayed report_type: Either summary or detail .Sp returns a list of rows of the summary report and sets these to @{$self\->{history_rows}} .IP "save_credit" 4 .IX Item "save_credit" This method saves the credit account for the company. .Sp Expected inputs: credit_id (int): (Optional) Id for the account entity_class (int): Class of the account, required (1 = vendor, 2 = customer) entity_id (int): \s-1ID\s0 of entity to attach to. description (text): Description of account discount (numeric): Early payment discount taxincluded (bool): Whether prices include tax. creditlimit (numeric): Credit limit discount_terms (int): How many days can elapse before the discount lapses too. terms (int): How many days can lapse before the invoice is overdue. meta_number (varchar): Account string identifier for the account. business_id (int): \s-1ID\s0 for business type. language (varchar): Language code for invoices. pricegroup_id (int): Price group curr (char): Currency identifier, three characters long. startdate (date): Date of the start of the relationship. enddate (date): Date of the end of the relationship. threshold (\s-1NUMERIC\s0): How much must be owed before the invoices can be paid. ar_ap_account_id (int): \s-1ID\s0 of ar/ap account. \s-1REQUIRED\s0 cash_account_id (int): \s-1ID\s0 of cash account (Optional) pay_to_name (text): Name to pay to or receive from. taxform_id (int); \s-1ID\s0 of tax form .IP "save_location" 4 .IX Item "save_location" This method saves an address for a company. .Sp Requires the following variables on the object: credit_id location_id location_class (1 = billing, 2 = shipping, 3 = sales) line_one line_two city state (can hold province info) mail_code (zip or postal code) country_code (\s-1ID\s0 of country) .IP "get_credit_id" 4 .IX Item "get_credit_id" This method returns the current credit id from the screen. .Sp Requires entity_id, meta_number, and entity_class be set. .IP "\fIget_metadata()\fR" 4 .IX Item "get_metadata()" This retrieves various information vor building the user interface. Among other things, it sets the following properties: \&\f(CW$self\fR\->{ar_ap_acc_list} = qw(list of ar or ap accounts) \&\f(CW$self\fR\->{cash_acc_list} = qw(list of cash accounts) \&\f(CW$self\fR\->{entity_classes} = qw(list of entity classes) \&\f(CW$self\fR\->{all_taxes} =qw(list of taxes) .IP "save_contact" 4 .IX Item "save_contact" Saves a contact. Requires credit_id, contact_class, description, and contact to be set. .Sp Requires the following be set: credit_id or entity_id contact_class description contact old_contact old_contact_class .IP "save_bank_account" 4 .IX Item "save_bank_account" Saves a bank account. Requires the following be set: entity_id bic (bank id) iban (account number) remark (remark for the account, optional) bank_account_id (id for record, optional) .IP "save_notes" 4 .IX Item "save_notes" Saves notes. The following must be set: credit_id: credit account to annotate. Must be set to annotate credit account entity_id: entitity to annotate. note: Note contents subject: Note subject .IP "search" 4 .IX Item "search" Searches for matching company records. Populates \f(CW$self\fR\->{search_results} with records found. .Sp Search criteria and inputs: account_class: required (1 for vendor, 2 for customer, etc) contact contact_info meta_number address city state mail_code country date_from date_to business_id legal_name control_code .Sp Account class may not be undef. meta_number is an exact match, as is control_code. All others specify ranges or partial matches. .IP "get_billing_info" 4 .IX Item "get_billing_info" Requires that the id field is set. Sets the following: .Sp legal_name meta_number control_code tax_id street1 street2 street3 city state mail_code country .IP "accounts" 4 .IX Item "accounts" Returns all accounts, and sets these to \f(CW$self\fR\->{accounts}. .Sp id and entity_class must be set. .IP "address($id)" 4 .IX Item "address($id)" Returns the location if it is specified by the \f(CW$id\fR argument. .IP "get" 4 .IX Item "get" Retrieves a company record and all info. .Sp taxform_list is set to a list of tax forms for the entity's country credit_list is set to a list of credit accounts locations is set to a list of locations contacts to a list of contacts notes to a list of notes bank_account to a list of bank accounts .IP "get_pricematrix" 4 .IX Item "get_pricematrix" This routine gets the price matrix for the customer or vendor. The pricematrix info is stored in the pricematrix hash entry. If a customer (account_class=1), it also populates a pricematrix_pricegroup entry. .IP "delete_pricematrix($entry_id)" 4 .IX Item "delete_pricematrix($entry_id)" This deletes a pricematrix line identified by \f(CW$entry_id\fR .IP "save_pricematrix" 4 .IX Item "save_pricematrix" Updates or inserts the price matrix. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2009, the LedgerSMB Core Team. This is licensed under the \s-1GNU \s0 General Public License, version 2, or at your option any later version. Please see the accompanying License.txt for more information.