Question
I can't seem to get the php program to write the results to the fshp and fbo files under the function write files section at
I can't seem to get the php program to write the results to the fshp and fbo files under the function write files section at the bottom of the code to complete writing to the files. I am not allowed to use global.
// END MAINLINE function PrepareFiles(&$fshp,&$fbo ) { $fshp = fopen("shipped.txt", "w") or die("shipped not opened"); fprintf($fshp," SHIPPED REPORT "); fprintf($fshp," Order Id Item Id Shipped Message "); $fbo = fopen("backorder.txt", "w") or die("backorder not opened"); fprintf($fbo," BACK ORDER REPORT "); fprintf($fbo," Order Id Item Id Backordered "); } function DoCalcs($qtyOnHand,$qtyRequested, &$qtyShipped, &$qtyBackOrdered, &$message) { printf(" DoCalcs "); /// if($qtyRequested <= $qtyOnHand) { $qtyShipped = $qtyRequested; $qtyBackordered = 0; $message = "Fully Filled"; } else { if($qtyOnHand !=0) { $qtyShipped = $qtyOnHand; $qtyBackOrdered = $qtyRequested - $qtyOnHand; $message = "Partially Filled"; } else { $qtyShipped = 0; $qtyBackOrdered = $qtyRequested; $message = "Out of Stock"; } } }
function WriteFiles($fship, $fbo, $orderId, $itemId, $qtyOnHand, $qtyRequested, &$qtyShipped, &$qtyBackOrdered, &$message) { printf(" WriteFiles "); fprintf($fshp, "$orderId $itemId $qtyShipped $message "); fprintf($fbo, "$orderId $itemId $qtyBackOrdered ");
}
?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started