Jump to content

Export Invoices to CSV


Adriano Faria

Recommended Posts

14 minutes ago, Vermith said:

You are aware that the support thread here links to the one i am replying in right now?

Right NOW yes. Before you bought another resource (Export PAYOUTS) and was asking support in this topic (Export INVOICES). Anyway, it is right now after you buy this. 

Will test the plugin in a couple of hours and will reply here with a fix or asking for more information if can’t reproduce it. 

Link to comment
  • Replies 51
  • Created
  • Last Reply
13 hours ago, Vermith said:

You are aware that the support thread here 

 

links to the one i am replying in right now?

Anyway trying to export like 2 months running in this error: (not working)


OutOfRangeException:  (0)
#0 /var/www/xxx/forum/init.php(448) : eval()'d code(153): IPS\Patterns\_ActiveRecord::load(5)
#1 /var/www/xxx/forum/system/Dispatcher/Controller.php(85): IPS\nexus\modules\admin\payments\hook181->exportInvoices()
#2 /var/www/xxx/forum/applications/nexus/modules/admin/payments/invoices.php(35): IPS\Dispatcher\_Controller->execute()
#3 /var/www/xxx/forum/system/Dispatcher/Dispatcher.php(146): IPS\nexus\modules\admin\payments\_invoices->execute()
#4 /var/www/xxx/forum/yyyy/index.php(13): IPS\_Dispatcher->run()
#5 {main}

Beside that download appears as:

DarkgrayChiefPharaohhound

Please, send a PM with ACP credentials. It is running fine on my install. Need to see what’s different in yours. 

Link to comment
  • 1 month later...
  • 6 months later...
  • 3 months later...
2 hours ago, Adriano Faria said:

I can but this isn't used only in Downloads so that info would be "blank" in all the rest of the exported file. Not sure I'll add this.

So how am I supposed to get totals for each file contributor? Or research when a contributor asks about their history. Find each file name 1 by 1? 

Its okay if there are blanks just handle it in sql with a “case when “ in your select statement. Something like  

SELECT The_other_fields, file_contrib_name
CASE
    WHEN file_contrib_name IS NULL THEN
     "N/A"
    ELSE file_contrib_name
END

Without this it’s impossible to do research per file contributor 

Link to comment
2 hours ago, SJ77 said:

Just to be clear, are you asking me to do anything or just wait?

Ok, I've made it now, from home:

Download the plugin. Open the XML with any HTML/PHP editor and find in the exportInvoice() function:

$toPut[11]  = $invoice->billcountry;

Add below:

		foreach ( $invoice->items as $item )
		{
			if ( $item instanceof \IPS\downloads\extensions\nexus\Item\File )
			{
				$contributor = \IPS\downloads\File::load( $item->id )->author();
			}
		}
		$toPut[12]  = $contributor ? $contributor->member_id : '---';
		$toPut[13]  = $contributor ? $contributor->name : '---';

Find in exportInvoices() function:

					if ( $item instanceof \IPS\nexus\extensions\nexus\Item\CouponDiscount )
					{
						$coupon 	= \IPS\nexus\Coupon::load( $item->id );
						$couponId 	= $coupon->code;
					}
					else
					{
						$couponId 	= '---';
					}

Add below:

					if ( $item instanceof \IPS\downloads\extensions\nexus\Item\File )
					{
						$contributor = \IPS\downloads\File::load( $item->id )->author();
					}

Find:

				$toPut[11]  = $invoice->billcountry;

Add below:

				$toPut[12]  = $contributor ? $contributor->member_id : '---';
				$toPut[13]  = $contributor ? $contributor->name : '---';

Then find, IN BOTH FUNCTIONS:

			$headers = array( 'Invoice ID', 'Status', 'Title', 'Member ID', 'Member Name', 'Total', 'Date', 'Coupon', 'Paid On', 'Discount', 'Currency', 'Bill Country' );

Change to:

$headers = array( 'Invoice ID', 'Status', 'Title', 'Member ID', 'Member Name', 'Total', 'Date', 'Coupon', 'Paid On', 'Discount', 'Currency', 'Bill Country', 'Member ID', 'Member Name' );

Results:

0Jh5GDk.png

Then save and reinstall the plugin.

Link to comment
11 minutes ago, Adriano Faria said:

You did something wrong, probably, which cause the hook to be ignored. I’ll send a PM with it attached tomorrow in the morning. 

Im sure I did not make any mistakes. Pretty easy instructions. Thank you for the help, let me know

Link to comment

Awesome, It works and now I have the columns I want. This will be such a huge help when it comes to taxes, or accounting of any kind.

I finally can see easily who my top contributors are and rank them all.  Thank you !!!!!!!!!!!!!!!

I think something is going on with my data tho. When I export ALL (by not picking any dates) I get garbled junk and a very small file.

gobble.JPG

Link to comment

I figured out that anything before Jan 8 2018 has issues. IF I start with Jan 7 I get an exception error and If I include Jan 6 I get the gooble garbage as in the above example.

So I think something is wrong in my data Jan 7, 

Do you have any tips? What table I should check?

Link to comment
On 8/14/2017 at 11:29 PM, JiigSaaw said:

So great !

Could you add some things to your mod ?

We need to have such infos for export :

  • SHIPPING ADDRESS
  • PHONE NUMBER
  • ITEMS WITH CUSTOM FIELDS
  • And actual infos of your mod

Because we sell clothes (custom) and we need an CSV with these infos to send for our manufacturer.

Thank you !

Was this ever included @Adriano Faria ?

Could the name of the item be included too?

Link to comment
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...