Hi,
Last few days I tried and tried to solve calculate a table with Repeatable Regions , Finally I had solve it..
[img] [/img]
I am attaching the file so that it can be of help to others...
Last few days I tried and tried to solve calculate a table with Repeatable Regions , Finally I had solve it..
[img] [/img]
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='calculate_repetable'>
<cms:editable name='first_name' required='1' type='text' />
<cms:editable name='last_name' required='1' type='text' />
<cms:repeatable name='business' >
<cms:editable name='product' label='Product Name' type='text' required='1'/>
<cms:editable name='product_squ' label='Product Code' type='text' required='0'/>
<cms:editable name='qty' label='Product quantity' type='text' required='1'/>
<cms:editable name='price' label='Product price' type='text' required='1'/>
<cms:editable name='discount' label='Product discount' type='text' required='1'/>
<cms:editable name='payment_amount' label='Payment Amount' type='text' required='1'/>
<cms:editable name='order_date' label='Product order date' type='text' required='1'/>
<cms:editable name='current_statuse' label='Product current_status' type='text' required='1'/>
<cms:editable
name="paymeny_mode"
label="Payment Mode"
label="Select one from these propert type"
opt_values='Cash | Cheque | Others | lobby'
type='dropdown'
required=''
/>
<cms:editable name='ectra_note' label='product_note' type='text' required='0'/>
</cms:repeatable>
</cms:template>
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<!-- Strat settings Global value for calculate -->
<cms:set quanity_total='0' scope='global' /><!-- vARIABLE SET total Qanty Value -->
<cms:set price_total='0' scope='global' /><!-- " total price Value -->
<cms:set discount_total='0' scope='global' /><!-- " total discount Value -->
<cms:set payment_total='0' scope='global' /><!-- " total payment value -->
<cms:set groupnetamnt='0' scope='global' /><!-- " total amount to pay value -->
<cms:set pending_total='0' scope='global' /><!--" total PENDING value -->
<!-- Wnd settings Global value for calculate kindly folow repetable are for more-->
<h2>Couchcms Repeatable Regions (Row) Table Calculation</h2>
<cms:pages masterpage=calculate_repetable>
<h2><cms:show first_name /> <cms:show last_name/></h2>
<table id="table">
<tr>
<th>Product Name</th>
<th>Product SQU</th>
<th>Quantity </th>
<th>Price </th>
<th>Discount</th>
<th>Ammount to pay</th>
<th>Payment</th>
<th>Pending Amount</th>
<th>Order Date</th>
<th>Status</th>
</tr>
<cms:show_repeatable 'business'>
<cms:set quanity_total = "<cms:add quanity_total qty />" scope='global' /><!-- total Sum quantity Calculation -->
<cms:set price_total = "<cms:add price_total price />" scope='global' /><!-- total Row Sum Calculation -->
<cms:set discount_total = "<cms:add discount_total discount />" scope='global' /> <!-- total Sum discount Calculation -->
<cms:set payment_total = "<cms:add payment_total payment_amount />" scope='global' /> <!-- total Sum payment Calculation -->
<cms:set netv = "<cms:mul qty price />" scope='global' /> <!-- Calculate amount to pay each for row -->
<cms:set netvt= "<cms:sub netv discount />" scope='global'/><!-- Final Calculate Amount to pay for each row -->
<cms:set penv= "<cms:sub netvt payment_amount/>" scope='global'/> <!-- Calculate pending amount for row -->
<cms:set groupnetamnt= "<cms:add groupnetamnt netvt/>" scope='global'/><!-- total sum amount to pay -->
<cms:set pending_total= "<cms:add pending_total penv/>" scope='global'/><!-- total Sum pending Calculation -->
<tr>
<td><cms:show product/></td> <!-- Show Product Name-->
<td><cms:show product_squ/></td><!-- Show Product SQU-->
<td style="text-align:right"> <cms:show qty/></td> <!-- Show Product Quantity-->
<td style="text-align:right"><cms:show price/></td> <!-- Show Product price-->
<td style="text-align:right"><cms:show discount/></td> <!-- Show Discount Name-->
<td style="text-align:right"><cms:show netvt/></td> <!-- Show Commision Amount-->
<td style="text-align:right"><cms:show payment_amount/></td> <!-- Show payment amount-->
<td style="text-align:right"><cms:show penv/></td> <!-- Show pending amount-->
<td class="date"><cms:show order_date/></td> <!-- Show order Date Name-->
<td class="status"><cms:show current_statuse/></td> <!-- Show Product Status-->
</tr>
</cms:show_repeatable>
</tbody>
<tfoot>
<tr class="bg-info">
<td>Total-</td>
<td></td>
<td style="text-align:right"><cms:show quanity_total/></td><!-- total quantity Value -->
<td style="text-align:right"><cms:show price_total/></td><!-- total Price Amount -->
<td style="text-align:right"><cms:show discount_total/></td> <!-- total Discount Amount -->
<td style="text-align:right"><cms:show groupnetamnt/></td><!-- total Comission Calculate Value -->
<td style="text-align:right"><cms:show payment_total/></td> <!-- total payment Amount-->
<td style="text-align:right"><cms:show pending_total/></td><!-- total pending Amount-->
<td>-</td>
<td>-</td>
</tr> </table>
</cms:pages>
</body>
</html>
<?php COUCH::invoke(); ?>
I am attaching the file so that it can be of help to others...