PHP - Automated Invoice Help
Hey PHPFreaks,
Back with another newbie question (I reckon). Currently i'm using this form: http://www.kartalin.nl/bestellen.php (Dutch). Upon entering your information you will be send to the confirmation page, where an automated email will be send to you (with the data you entered) and to me (so I can tell an order has been placed). After that, i'll have to create a invoice and send it to them, a tedious job that i'd much rather have automatized. Even though its already rather obvious what has been ordered, its just that i'm lacking 2 things: 1. I need the invoice number to be identical and in a sequence, so K001, K002, K003 etc. Since i'm currently only using basic HTML in this email, I don't know if that's possible, or how to do it. 2. People pick both a product, and their pick of choice on how to ship the product. There are quite alot of combinations, so for that i'll probably need some tool (called a calculater? haha..) that actually adds those 2 prices and calculates the total amount to be payed. No VAT calculator is needed. Also i've found the current HTML I send in via the mail to be quite dodgy. I cant use special characters for example, therefor it might be good to have these 2 options in a system that actually allows for full HTML aswell. This could come in handy when I need to create a table to sum those different prices up. Currently using this code: <?php // your email address $youremail = "my@email.com"; // field validation if ($naam=="" || $achternaam=="") { print ("Alle velden moeten worden ingevuld!"); } else { // send email $headers = "From: \"$naam\" <$email>\n"; $subject = "Bestelling Kartalin"; $from = "Kartalin.nl <info@kartalin.nl>"; $message = "Dear $name<br /></br /> blabla your order has been received etc. "; mail ("$youremail", $subject, $message, "From: $from\nContent-Type: text/html; charset=iso-8859-1"); mail ("$email", $subject, $message, "From: $from\nContent-Type: text/html; charset=iso-8859-1"); } ?> I'd appreciate it a lot if someone could help me with this! Similar TutorialsHello, I need help creating dynamic order (for invoice) in php. Its like an invoice, where the header is entered once, but the products, quantity are entered more than one time in the same page, so for example, if the user select a product and click add, it will displayed on a row & a new row become active. Also, the table called order, how should I manage it? As it may had multiple products per it? Any help is much appreciated Thanks Hi all, Hopefully this will be a very easy question for one of you! Basically, I've created a little invoice script, and I need some help with the invoice data (i.e the item info, qty and the price). My question is how do i deal with the data from multiple rows containing 3 text fields each (item, qty and price). I've been playing with a foreach loop, which I can make echo info in the item field for each row. How do I incorporate the other fields (the qty and price)? Can I build an array to hold it all? Thanks for any help! Jim I am trying to use a Wordpress module called WooCommerce PDF Invoices to make event tickets by modifying the layout of the invoice to create an online ticket to printout. I've successful reformatted the layout and it works like a charm except for one thing. The problem I have is that no matter what is bought the invoice reads "This is a ticket" which I hardcoded into the invoice design. What I would like is an if/then statement inserted into the invoice design that will print between "This is a ticket" or "This is a receipt" depending on if they purchase one of the 4 ticket items. "This is a recept" If ticket 1 then print "This is a ticket" else print "This is a receipt. If ticket 2 then print "This is a ticket" else print "This is a receipt. If ticket 3 then print "This is a ticket" else print "This is a receipt. If ticket 4 then print "This is a ticket" all else print "This is a receipt." I completely redesigned the woocommerce pdf invoice to look like an online ticket. The first half looks like an actual ticket. <?php global $wpo_wcpdf; ?> <table align="center" cellpadding="0" cellspacing="0" class="pdfbackground" style="width: 700px; height: 350px"> <tr> <td style="width: 20px"> </td> <td style="width: 285px"> </td> <td style="width: 300px"> </td> <td style="width: 75px"> </td> <td style="width: 20px"> </td> </tr> <tr> <td rowspan="4" style="width: 20px"> </td> <td class="pdflogo" rowspan="4" style="width: 285px"><br /><div id="container"><div><?php if( $wpo_wcpdf->get_header_logo_id() ) { $wpo_wcpdf->header_logo(); } else { _e( 'Ticket', 'wpo_wcpdf' ); } ?></div><div class="order-information"> <br /><br /><hr width=50% color=#0087E1><?php $date_setting = isset($wpo_wcpdf->settings->template_settings['display_date'])?$wpo_wcpdf->settings->template_settings['display_date']:'order_date'; $number_setting = isset($wpo_wcpdf->settings->template_settings['display_number'])?$wpo_wcpdf->settings->template_settings['display_number']:'order_number'; // set $display date & label to user setting if ( $date_setting == 'invoice_date' ) { $display_date = $wpo_wcpdf->get_invoice_date(); $display_date_label = __( 'Event Date:', 'wpo_wcpdf' ); } else { $display_date = $wpo_wcpdf->get_order_date(); $display_date_label = __( 'Order Date:', 'wpo_wcpdf' ); } // set $display number & label to user setting if ( $number_setting == 'invoice_number' ) { $display_number = $wpo_wcpdf->get_invoice_number(); $display_number_label = __( 'Transaction Number:', 'wpo_wcpdf' ); } else { $display_number = $wpo_wcpdf->get_order_number(); $display_number_label = __( 'Order Number:', 'wpo_wcpdf' ); } ?> <span class="order-date-label"><?php echo $display_date_label; ?></span> <span class="order-date"><?php echo $display_date; ?></span><br /> <span class="order-number-label"><?php echo $display_number_label; ?></span> <span class="order-number"><?php echo $display_number; ?></span><br /> <br /> <br /> </div></div></td> <td style="width: 300px"><div class="shop-name"><h3><?php $wpo_wcpdf->shop_name(); ?></h3><br /> SPONSORED BY: <br />SPONSOR 1 LOGO | SPONSOR 2 LOGO </div> </td> <td rowspan="4" style="width: 75"><br /><br /><br /><br /><br /><br /> <img alt="" height="126" src="http://www.3corlando.com/wp-content/uploads/2014/06/barcode.png" width="71" class="barcode" /></td> <td rowspan="4" style="width: 20px"> </td> </tr> <tr> <td style="width: 300px"><hr width=75% color=#0087E1><div class="shop-address"><?php $wpo_wcpdf->shop_address(); ?></div> </td> </tr> <tr> <td style="width: 300px"> </td> </tr> <tr> <td style="width: 300px"></td> </tr> <tr> <td class="pdfborder" style="width: 20px"> </td> <td class="pdfticket" colspan="3"><div class="pdfticket"><hr width=50% color=#0087E1>***This is a Receipt*** </div> </td> <td class="pdfborder" style="width: 20px"> </td> </tr> </table>And the second half looks like an invoice. <!-- head container --> <hr> <table class="order-details"> <thead> <tr> <th class="product-label"><?php _e('Shop Items', 'wpo_wcpdf'); ?></th> <th class="quantity-label"><?php _e('Quantity', 'wpo_wcpdf'); ?></th> <th class="price-label"><?php _e('Price', 'wpo_wcpdf'); ?></th> </tr> </thead> <tbody> <?php $items = $wpo_wcpdf->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item ) : ?><tr> <td class="description"> <?php $description_label = __( 'Description', 'wpo_wcpdf' ); // registering alternate label translation ?> <span class="item-name"><?php echo $item['name']; ?></span><span class="item-meta"><?php echo $item['meta']; ?></span> <dl class="meta"> <?php if( !empty( $item['sku'] ) ) : ?><dt><?php _e( 'SKU:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['sku']; ?></dd><?php endif; ?> <?php if( !empty( $item['weight'] ) ) : ?><dt><?php _e( 'Weight:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?> </dl> </td> <td class="quantity"><?php echo $item['quantity']; ?></td> <td class="price"><?php echo $item['order_price']; ?></td> </tr><?php endforeach; endif; ?> </tbody> <tfoot> <tr class="no-borders"> <td class="no-borders" colspan="3"> <table class="totals"> <tfoot> <?php foreach( $wpo_wcpdf->get_woocommerce_totals() as $total ) : ?> <tr> <td class="no-borders"> </td> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?> </tfoot> </table> </td> </tr> </tfoot> </table><!-- order-details --> <table class="notes container"> <tr> <td colspan="3"> <div class="notes-shipping"> <?php if ( $wpo_wcpdf->get_shipping_notes() ) : ?> <h3><?php _e( 'Customer Notes', 'wpo_wcpdf' ); ?></h3> <?php $wpo_wcpdf->shipping_notes(); ?> <?php endif; ?> </div> </td> </tr> </table><!-- notes container --> <?php if ( $wpo_wcpdf->get_footer() ): ?> <div id="footer"> <?php $wpo_wcpdf->footer(); ?> </div><!-- #letter-footer --> <?php endif; ?>I want to identify one of my 4 ticket items that may appear where the invoice prints the items and when one of them does appear it changes "This is a receipt" to "This is a ticket" in the first half. Is something like this possible? If so, can anyone give me a direction to find the coding for this? Can anybody give me an idea how to write this in php. I'm a pro at html but I've only taught myself how to modify existing php coding. I can't write it from scratch. Any help is appreciated. What's the best way to display when a page was last edited/modified? Hi there,
Is there anyway I can create a file that records any changes made via FTP automatically - like a simple PHP script that writes to a changelog text file?
Thanks!
CREATE TABLE `members` ( `id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; Hi, i would like to add values automattically from a form that my users fill out that corresponds to their login details. The form templete is above. Thanks! Hi, how to send an automated email to someone using PHP when ever a Ticket's date expires. The date filed in a table stored in MySQL databse. The Ticket table in MySQL has the following fields: 'ticket_id', 'price','purchase_date', 'expiry_date'. I have already tried with MySQL's Event-Handler feature and PHP's send email feature. Also this can not be done by database triggers as triggers are fired only when the trigger event happens(insert/update/delete) . So, I would be very grateful if anyone help this. Thanks. Loga I'm working on a site that has close to a hundred employees, each with an email address. They want me to add a feature to where people can contact these employees, without actually knowing their email address. To do that, I made a new window that pops up when they click to email someone, and it asks the user for their name, email address, and a short message. My problem is that the contact form is the same for every person. I don't know how to make that form direct to each individual person, without making each page by hand. (Something I don't want to do because there are so many and new employees being added all the time.) Thanks in advance to all you who are much wiser than I. Please let me know if you need more info or source code. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=313625.0 Hi guys, As a uni student i have to reference alot and my uni has its own prefered system. I would like to make referencing as easy as possible. http://library.scotch.vic.edu.au/research/biblios/ScotchBib/index.htm has a neat system that makes referencing quite easy. My question is how would i start the coding. When the form is sent all it does is string together the inputed text and numbers. What would this code look like and how could i display it in a 'Select All' Box? Hi, Is it possible to send an auto email to a person as per the target date in a datagrid column of Flash CS4 (AS 3.0)? I was told that PHP will help in this regard. I have the following example file attached herewith. It should check the target date column and if the target date is equal to current date then it should send an auto e-mail to the respective person using the E-Mail ID from the Flash datagrid control. For example (as per attached list): An email to be sent to Mr. Rangarajan on 15-APR-12 with subject "Submission of BCM Procedure draft" using his email id from the "E-Mail" column of the grid i.e. rrajan@demo.com Please let me know whether it is possible in PHP? Thanks. |