<?php
session_start();

if (!isset($_SESSION['userID'])) {
    header("Location: sign-in.php");
    exit();
}
$_SESSION['focus']=3;
require_once "SqlConnection/MySqlConnection.php";
$userID= $_SESSION['userID'];
$invoiceNumber= rand(0,1000000);

?>

<!DOCTYPE html>
<html lang="en" dir="ltr" data-scompiler-id="0">


<head>
    <meta charSet="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="format-detection" content="telephone=no" />
    <title>Create Invoice</title>
    <?php
        include('headerLinks.php');
     ?>
    
</head>

<body><!-- sa-app -->
<div class="sa-app sa-app--desktop-sidebar-shown sa-app--mobile-sidebar-hidden sa-app--toolbar-fixed">
<?php
        include('sidebar.php');
     ?> 
        
        <div class="sa-app__content"><!-- sa-app__toolbar -->
            <?php
            include('navbar.php');
            ?> 
            <div id="top" class="sa-app__body">
                <div class="mx-sm-2 px-2 px-sm-3 px-xxl-4 pb-6">
                    <div class="container">
                        <div class="py-5">
                        </div>
                        <div class="sa-entity-layout" data-sa-container-query="{&quot;920&quot;:&quot;sa-entity-layout--size--md&quot;,&quot;1100&quot;:&quot;sa-entity-layout--size--lg&quot;}">
                            <form action="save-invoice.php" method="POST">
                                <div class="sa-entity-layout__body">
                                    <div class="sa-entity-layout__main">
                                        <div class="card">
                                            <div class="card-body p-5">
                                                <div class="mb-5">
                                                    <h2 class="mb-0 fs-exact-18">Invoice Number #<?php echo $invoiceNumber ?></h2>
                                                    <input type="hidden" name="invoiceNumber" value="<?php echo $invoiceNumber ?>" />
                                                </div>
                                                <div class="col-12 mt-1">
                                                    <div class="row">
                                                        <div class="col-6"><div class="mb-4"><label for="form-product/name" class="form-label">Date</label><input type="datetime-local" class="form-control"  name="date" value="" /></div></div>
                                                        <div class="col-6"><div class="mb-4"><label for="form-product/name" class="form-label">Customer Name</label><input type="text" class="form-control" name="customerName" value="" /></div></div>
                                                    </div>
                                                </div>                                                
                                                <div class="col-12 mt-1">
                                                    <div class="row">
                                                        <div class="col-6"><div class="mb-4"><label for="form-product/name" class="form-label">Customer Address</label><input type="text" class="form-control" name="customerAddress1" value="" /></div></div>
                                                        <div class="col-6"><div class="mb-4"><label for="form-product/name" class="form-label">ServiceType</label><input type="text" class="form-control" name="serviceType1" value=""  /></div></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">
                                                        <!-- address 2-->
                                                        <div class="col-6"><div class="mb-4"><input type="text" class="form-control" name="customerAddress2" value=""  /></div></div>
                                                        <!-- serviceType 2-->
                                                        <div class="col-6"><div class="mb-4"><input type="text" class="form-control" name="serviceType2" value=""  /></div></div>
                                                    </div>
                                                </div>                                                
                                                <div class="col-12 mt-1">
                                                    <div class="row">
                                                        <!-- address 3-->
                                                        <div class="col-6"><div class="mb-4"><input type="text" class="form-control" name="customerAddress3" value=""  /></div></div>
                                                        <!-- serviceType 3-->
                                                        <div class="col-6"><div class="mb-4"><input type="text" class="form-control" name="serviceType3" value=""  /></div></div>
                                                    </div>
                                                </div>  
                                                <hr>
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><label>ITEM</label></div>
                                                        <div class="col-7"><label>DESCRIPTION</label></div>
                                                        <!-- <div class="col-2"><label># DAYS</label></div>                                                         -->
                                                        <div class="col-2"><label>PRICE/RATE</label></div>                                                        
                                                        <div class="col-2"><label>TOTAL</label></div>                                                        
                                                    </div>
                                                </div>  
                                                <hr>
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number1" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc1" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days1" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate1" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total1" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number2" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc2" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days2" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate2" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total2" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number3" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc3" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days3" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate3" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total3" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number4" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc4" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days4" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate4" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total4" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number5" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc5" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days5" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate5" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total5" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number6" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc6" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days6" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate6" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total6" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number7" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc7" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days7" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate7" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total7" value="" /></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12 mt-1">
                                                    <div class="row">                                                        
                                                        <div class="col-1"><input type="text" class="form-control" name="number8" value="" /></div>
                                                        <div class="col-7"><input type="text" class="form-control" name="desc8" value="" /></div>
                                                        <input type="hidden" class="form-control" name="days8" value="" />
                                                        <div class="col-2"><input type="text" class="form-control" name="rate8" value="" /></div>
                                                        <div class="col-2"><input type="text" class="form-control" name="total8" value="" /></div>
                                                    </div>
                                                </div>  
                                                <br>
                                                <br>
                                                <div class="col-12">
                                                    <div class="row">
                                                        <div class="col-6"><div class="mb-4"><input type="hidden" class="form-control" name="payment" value="No Payment Recorded"  /></div></div>
                                                        <div class="col-2"></div>
                                                        <div class="col-4"><div class="mb-4"><label for="form-product/name" class="form-label">HST</label><input type="text" class="form-control" name="hst" value=""  /></div></div>
                                                    </div>
                                                </div>
                                                <div class="col-12">
                                                    <div class="row">
                                                        <div class="col-6"></div>
                                                        <div class="col-2"></div>
                                                        <div class="col-4"><div class="mb-4"><label for="form-product/name" class="form-label">Grand Total</label><input type="text" class="form-control" name="subtotal" value=""  /></div></div>
                                                    </div>
                                                </div>  
                                                <div class="col-12">
                                                    <div class="row">
                                                        <div class="col-6"></div>
                                                        <div class="col-2"></div>
                                                        <div class="col-4"><div class="mb-4"><input type="hidden" class="form-control" name="totalTax" value="0"  /></div></div>
                                                    </div>
                                                </div>                                                
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <br>                               
                                <div class="col-3">
                                    <input type="submit" class="btn btn-primary w-100" value="Save" />                                    
                                </div>                                
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <?php
            include('footer.php');
            ?>
        </div>         
    </div>
    <div class="sa-app__toasts toast-container bottom-0 end-0"></div>
    </div>
    <?php 
        include('footerLinks.php');
    ?>
</body>

</html>