Jump to content

CreateInvoice


cools2

Recommended Posts

Hello,

What i do wrong?

I have main page with button pay, after clicking i want to create invoice. 
Its look like this:


$('.submit').on('click', function () {
                jQuery.post('{$systemurl}includes/hooks/ajax.php', {action:'createInvoice'}, function(data) {
                    console.log(data);
                });
        });

On the file ajax.php:

<?php
use Illuminate\Database\Capsule\Manager as Capsule;

if($_POST['action'] == 'createInvoice'){

    function getAdminUserName() {
        $adminData = Capsule::table('tbladmins')
            ->where('disabled', '=', 0)
            ->first();
        if (!empty($adminData))
            return $adminData->username;
        else
            die('No admin exist. Why So?');
    }

    $command = 'CreateInvoice';
    $postData = array(
        'userid' => '1',
        'status' => 'Unpaid',
        'sendinvoice' => '1',
        'paymentmethod' => 'mailin',
        'taxrate' => '10.00',
        'date' => '2016-01-01',
        'duedate' => '2016-01-08',
        'itemdescription1' => 'Sample Invoice Item',
        'itemamount1' => '15.95',
        'itemtaxed1' => '0',
        'itemdescription2' => 'Sample Second Invoice Item',
        'itemamount2' => '1.00',
        'itemtaxed2' => '1',
        'autoappliedcredit' => '0',
    );
    $adminUsername = getAdminUserName(); 

    $results = localAPI($command, $postData, $adminUsername);
    print_r($results);
    die();
}

answer is : 500 (Internal Server Error)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated