Skip to content
No description, website, or topics provided.
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
python
.gitignore
LICENSE
README.md
billing-automation.sh

README.md

billing-automation

Installing billing automation scripts

  • Create a folder in your Documents folder named billing-automation.

  • Copy and paste billing-automation.sh and python folder into the billing-automation folder. It is very important that you install in this folder.

  • Open a Terminal window (search for the Terminal with Spotlight) and use the following commands:

    cd ~/Documents/billing-automation

    chmod 755 billing-automation.sh python/*.py

    The first command takes you into the billing automation folder (directory). The second command makes the scripts executable.

    You are now ready to go.

Running the billing-automation.sh script

  • In the Terminal window, enter the following command to run the script:

    ./billing-automation.sh

  • The script will check to make sure specific programs are installed. If they are not, the script will notify you, and they will need to be installed.

    The easiest way to install the programs is to use Homebrew (Mac). You can install Homebrew by going to the http://brew.sh/.

    After Homebrew is installed you can install the required programs with the following command:

    brew install poppler ghostscript

  • If all the necessary programs are installed, the script will continue and create necessary folders for processing. The script will stop running after creating the necessary folders, so you will need to start the script again. You can just hit the UP arrow on the keyboard to go to the previous command you just ran, which should be the script command above. Hit Enter (Return) on the keyboard when the above command is showing in the Terminal.

    A folder named billing will be created. All the invoices, statements and tearsheets will go in this folder in subfolders. Here is the basic breakdown of the billing folder.

      billing
      |_ email
      |_ pdfs
      |_ processed
      |_ settings
      |_ tearsheets
    

    To begin, you need to place your invoices and statements PDFs in the pdfs folder. The naming convention for these files should be as follows:

      01-invoices-Johndoe0116XX.pdf
      01-statements-Johndoe0116XX.pdf
      02-invoices-Johndoe0116XY.pdf
      02-statements-Johndoe0116XY.pdf
    

    The first part of the file name (01, 02, 03...99) is for ordering. Make sure to use a 0 before single digit numbers.

    The second part of the file name (invoices, statements) tells what it is, invoices or statments.

    The third part of the file name (Johndoe0116XX, Johndoe0116XY, etc.) is the sales rep followed by publication. The publication needs to in the form of MMYY followed by the two letter code for the publication (XX, XY, etc.). The two letter codes need to be entered into the publications.txt file in the settings folder. The text file is created automatically with known publication codes. This file should be checked, and other codes can be added. The codes are all caps and separated by commas, no spaces.

  • Now that the invoices and statements PDFs are in the pdfs folder, we need to split them. If the script is not running, make sure ./billing-automation.sh is in the Terminal and hit Enter. You will want to enter 1 to split the PDFs. A folder named processed will be created with rep-publication folders containing the split files.

  • After the files are successfully split, you will want to merge them. Enter 2 to merge the PDFs. This process merges each individual publication. A folder named merge will be created in each publication folder and will contain the merged PDFs (invoices and statements). Files will be merged for each advertiser, as well as all of the PDFs being merged into a file that starts with 00.

  • After the merge completes successfully, you will want to run the merge all process. Enter 3 to merge all. This process merges all publications. You will need to run this process even if you only have one publication. The all merged PDFs will be created in a folder named 00-all-merged.

  • After the merge all process has completed successfully, you can run the optional recreate all merge files process. If you modify the 00-all-merged.pdf file by adding stamps or other modifications and want those changes to be applied to the individual client files, enter 4 to recreate those files with your changes.

  • After the merge all process has completed successfully, you can run the optional recreate files with new statements process. Generate a new file with your statements, and name the file 00-statements.pdf. Drop the file in the 00-all-merged folder. After the file is in the correct folder, enter 5, and the statements in the individual files will be updated. This will also update any statements that may be in any files in the email folder.

  • If you want to create a master file with the remaining client files left in the 000-files folder after moving the emailed files to the email folder, you can enter 6. This will create a file named 00-all-print-files.pdf in the 00-all-merged folder. This file can then be printed if desired.

  • After the merge all process has completed successfully, you can now run the email process. You will need to copy any of the merged PDFs that you want to email into the email folder. Keep in mind there must have been an email address in the statement or invoice in order for the email process to work correctly for that PDF. Enter 7 to run the email process. This will create new messages in Mail for each PDF. You can modify the generic message and subject and then send the email. The general settings are saved in the settings folder in the files email-from.txt, which contains the email address of the sender, email-subject.txt, which contains the subject for each email, and email-message.txt, which contains the message. You can change these by entering something new in each file.

  • If you desire to quit the program at any time, you can enter 8 to quit.

Keep in mind as you go through each step, you can modify the PDFs in the different folders manually and those changes will move on to the next step. However, if you make changes manually and run the same process again, your changes will be overwritten, so be careful with the options you select to run.

If you want to start over from the start with your publications, remove the processed folder in the billing folder and the processed folder in the tearsheets folder. It is recommended you do this if at anytime in the billing process, you encounter an error, or the script is stopped before a specific process completes.

You can’t perform that action at this time.