This topic is locked
[SOLVED]

 Printing Custom Page Issue

8/23/2011 11:39:31 AM
PHPRunner General questions
cyberjas2001 author

Hello everyone,

I have this problem on my system, I have created a custom page some kind of receipt for our records, so every time we add equipment to our warehouse we print a receipt after we're done, but i have this little issue, i dont know if it has something to do with cookies, but if 2 people are saving data at the same time and then tries to print on their own printer & computers, they will get the same receipt. In other words instead of getting 2 receipts for 2 different transactions, they'll get just 1 repeated receipt.

Does anyone knows a reason why this is happening? I need an advise.

Thanks a lot.
PHPRunner Rules by the way! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=17602&image=1&table=forumtopics' class='bbc_emoticon' alt=':D' />

Sergey Kornilov admin 8/23/2011

Probably it has something with the way you generate transaction numbers. More info is required on this.

cyberjas2001 author 8/24/2011

When I add a new vehicle to my system, I just click ADD NEW, the ID# is the same Receipt#.

Then I click SAVE and I have created a custom button to print a "Receipt"

You click "Receipt" and it shows the preview of the receipt and the printer options.

You hit print and that's it. That's how the process goes.
The problem is when 2 people hit Print at the same time they will get the same receipt, even if they are in different computers with different printers. they will get the same receipt no matter what.
Please let me know if you need something else. Thanks!

Sergey Kornilov admin 8/24/2011

If you use MySQL's autoincrement field to generate IDs for new records all IDs will be different and this kind of collision never occurs. I guess you generate transaction numbers manually and not doing it the right way. You need to fix this ensuring each transaction number is unique.

cyberjas2001 author 8/25/2011

Here's a snapshot of my table container, my Receipt is Auto Increment and unique. I dont think that's the problem


cyberjas2001 author 8/25/2011

Here's a clear example of what's going on:



Note the URL of this page, clearly says id: 182000, and the Receipt# 182001, two different numbers for the same transaction. And this just happens when 2 people save something at the same time and then they tried to print. The receipt id goes crazy and shows something totally different.
I used this code to open my custom page:



<INPUT class=button onclick="window.open('EIR2.php?id={$show_key1}','','scrollbars=yes,menubar=no,height=600,width=800,resizable=no,toolbar=no,location=no,status=no');" value=Receipt type=button>


Probably the way I'm opening my custom page is not the right one.

Any ideas???

Thanks!

C
cgphp 8/25/2011

Where is the custom button ? Place it in a PHP snippet or use a PHPrunner custom button. You can't put a PHP var directly in the HTML source.

cyberjas2001 author 8/25/2011

I have this button in the "View Page" next to "Back to List"