Automate Billing Reports using INVOICE
3 min
\<font color="#67854e"> question \</font> how can i automate and customize billing reports? \<font color="#67854e"> answer \</font> the invoice command is a reporting tool designed to generate customized, detailed bills the invoice function is mainly used for two specific types of operations heifer ranches for calculating and billing daily charges based on animal inventory over a period of time service providers (such as veterinarians and hoof trimmers) for calculating and billing flat rates per event or procedure performed \<font color="#f97316"> important \</font> the invoice command cannot run without an invoice definition file this file defines your charges, credits, and reporting structure by listing all the rules for billing assistance from technical support is often required to initially set up or update this file, as it requires specific formatting see create or manage the invoice definition file docid\ p s1xrdkxpmv29 vogm92 to learn more create or manage the invoice definition file the invoice command cannot run without an invoice definition file basically, this file defines your charges, credits, and reporting structure when you run the invoice command, dairycomp looks for this file in your active herds folder typically, this file is named \[herdcode] inv (for example, 91230000 inv ) if the \[herdcode] inv file is missing, a prompt displays asking you to manually choose an invoice definition file with a different name or location if you do not have an invoice definition file, you'll need to create one creating or editing the invoice definition file to view and edit the invoice definition file, enter invoice\edit the existing definition file opens in your system's default text editor (such as notepad) if the file does not exist, you'll be prompted to select a different file the invoice\edit command will not automatically create a new, blank file you must manually create a plain text file, save it as \[herdcode] inv , and begin defining your charges before running the command tip if you manage multiple herds, create a generic template inv file and save it in the herds\basis folder this serves as a reliable starting point for new clients understanding the structure of the invoice definition file every active line in your inv file (lines not starting with a period or a blank line) must follow a strict, seven field, comma separated structure, where the type tag occupies the first field type, description, cost/item, item/event, for statement, pattern, owner\[s] the single character type tag is essential as it tells the program how to calculate the charge each available type tag is explained below type a (address/header) this category defines address and contact lines for the invoice header and typically contains customer or ranch contact information type i (inventory) this category defines daily boarding or care charges cost is multiplied by days in the billing period type e, r, p, v, t (events/procedures) this category defines specific treatments, reproduction events, preventatives, or vaccinations cost is typically multiplied by the count of the event/item type x (credit) this category defines rebates for an animal death or loss cost is typically multiplied by the count of the event a negative value is required in the cost field type c (comment/group) this category is used for adding section titles, subtitles, or blank lines for grouping charges type m (manual) this category defines extra charges like hauling or truck rental it applies a manual charge set using the \m switch type s (supplemental) this category embeds a seperate, existing dairycomp report into the invoice output it is typically used for including an activity log or sorted report with the invoice note lines starting with a period ( ) are treated as comments and ignored by the program, which is often used for notes or formatting examples of charge lines when building your invoice, you combine the type tag with the next four fields—description, cost, item/event, and the for statement—to create the final billable line the examples below show how the type tag controls the logic of the charge \<font color="#67854e"> inventory charges (i) \</font> these lines calculate costs based on the number of days the animal was present for example, you can apply different daily rates based on which pen ( pen= ) the animals are currently in, using the for statement for filtering for example, i, stage 1 animals pen=111, 1 00, , pen=111 , charges $1 00 per day only to animals in pen 111 \<font color="#67854e"> event charges (e) \</font> these lines calculate costs based on the number of times a specific event occurred the same event ( resp ) can be charged at different rates depending on the animal's age ( age<3 vs age>2 ) for example, e, respiratory first 60 days, 20 00, resp, age<3 , charges $20 00 for a resp event only if the animal is under 60 days old \<font color="#67854e"> credit charges (x) \</font> lines beginning with x are used to define credit items, which deduct money from the total when defining a credit, you must use a negative value in the cost field for example, x, death loss credit, 2 93, dof , applies a $2 93 credit for every death on farm (dof) event customize charges with filtering and patterns you can control exactly which animals or events trigger a charge using the filtering fields \<font color="#67854e"> for statement (field 5) \</font> use any standard dairycomp condition (e g , aged<240, lact=1, dof>150 stay=0) in this field to apply the charge only to animals that meet that criteria for example, i, daily charge < 8 mos, 2 81, , aged<240 , only charges animals younger than 240 days \<font color="#67854e"> pattern matching (field 6) \</font> for event charges ( e , p , v , r , t ), you can use this field to charge different prices for the same event based on the specific remark entered when the event was logged for example, you could charge $29 00 for a pneu event with the remark draxn , and $17 00 for one with exce run the invoice command running the invoice command evaluates all animal records within the billing period, determines which records satisfy the criteria in the invoice definition file, and generates the final invoice the dates of the report are determined by the switches you use no switch (default) the billing interval will run from the day following the prior invoice run's end date through yesterday typically used for continuing a standard billing cycle invoice\d prompts you to enter the start and end dates use this switch for re running or manually adjusting a report invoice\dl sets the billing interval from the first day of the prior month through the last day of the prior month use this switch for standard monthly billing invoice\dt sets the billing interval to today's date as both the start and end date use this switch for single day billing for services; inventory summaries are excluded additionally, you can modify the output and the definition file used with these optional switches invoice\xext uses a definition file with the extension ext instead of the default inv (for example, invoice\xcow looks for \[herdcode] cow ) invoice\nnnnn sets the invoice number to nnnn for display only use \n without a number to be prompted for the number invoice\m activates manual charges defined separately once you have refined your invoice command and chosen your preferred switches, it is common practice to save the entire string as a command abbreviation, such as bill this allows you to run your monthly billing quickly without re typing the full syntax every time for example, you can create a command abbreviation so that entering bill automatically runs invoice\xin1 (or whichever specific switches your herd requires) after running the command, the invoice displays in the report preview window summary totals display at the beginning, followed by the itemized charges add a logo to invoices dairycomp lets you add a company logo to the top of your invoices to do so, run invoice\logo in the command line to open the edit invoice logo window check the box for enable custom invoice logo click the select logo button to select an image file for your logo click the edit logo button to open an image editor from here you can crop the logo image, adjust its colors, and more select a position for the logo at the top of your invoice left , center , or right click the preview invoice button to open a preview window and see how the logo appears in the invoice when finished, click the save settings button now when you create an invoice, the logo displays at the top of the page note if you haven't set up your inv file yet, a prompt will remind you to do so before you can use this feature manually confirm data prompts if your invoice definition file docid\ p s1xrdkxpmv29 vogm92 contains lines that are incomplete or ambiguous, a pop up window displays asking you to manually confirm or enter the required data for that specific charge line (i e , the cost, item count, or condition) for instance, in the example shown below, the system has paused the invoice run and asks the user to manually confirm the number of retag permaflex events to charge for if a prompt appears, check the type and description displayed in the window (like type p and desc retag permaflex ) to identify which line is causing the issue you must provide the missing numerical value (usually a count or cost) for the invoice to proceed clicking ok in the prompt applies the value only for the current report run; it does not save the change to the invoice definition file to permanently eliminate the prompt, you must exit the command, use invoice\edit , and correct the ambiguous line in the file if you do not want to apply the charge, enter 0 \<font color="#f97316"> important \</font> to avoid prompts, ensure every line that defines a charge (i, e, r, p, v, t, x) is completely defined and correctly formatted with all seven comma separated fields the most common cause is missing the item/event (field 4) or a detailed enough for statement (field 5)