Hey guys im doing a POS for my body's store and im really bitting my nails on the form total calculations.
this is a test script
but it only calculates the grand total not the form part - <script type="text/javascript">
-
-
///////////this is for filed total
-
function calc(A,B,SUM) {
-
var one = Number(A);
-
if (isNaN(one)) { alert('Invalid entry: '+A); one=0; }
-
var two = Number(document.getElementById(B).value);
-
if (isNaN(two)) { alert('Invalid entry: '+B); two=0; }
-
document.getElementById(SUM).value = one + two;
-
}
-
-
-
/////////////this is for grand total
-
function calcTotal(txtBox, totBox)
-
{
-
var totVal;
-
try
-
{
-
totVal = document.getElementById(totBox).value;
-
if(totVal!= null && totVal!='')
-
{
-
document.getElementById(totBox).value= eval(parseInt(document.getElementById(totBox).value) + parseInt(txtBox.value));
-
}
-
else
-
{
-
document.getElementById(totBox).value= txtBox.value;
-
}
-
}
-
catch(e)
-
{}
-
}
they both work individual but when i add one it stops the filed calculator - <table>
-
<tr>
-
<td width="337"><input name="sum1" id="op1" value="" onChange="calc(this.value,'op2','result')" /> <input name="sum2" value="" id="op2" onChange="calc(this.value,'op1','result')" /></td>
-
<td width="176"><input type="text" id="result" onBlur="calcTotal(this, 'tot')" /></td>
-
</tr>
-
<tr>
-
<td><input name="op" id="op3" value="" onchange="calc(this.value,'op4','result2')" /><input name="op" value="" id="op4" onchange="calc(this.value,'op3','result2')" /></td>
-
<td><input type="text" id="result2" onBlur="calcTotal(this, 'tot')" /></td>
-
</tr>
-
<tr>
-
<td> <input name="op" id="op5" value="" onchange="calc(this.value,'op5','result3')" /><input name="op" value="" id="op6" onchange="calc(this.value,'op6','result3')" /></td>
-
<td><input type="text" id="result3" onBlur="calcTotal(this, 'tot')" /></td>
-
</tr>
-
<tr>
-
<td>Total</td>
-
<td><input type="text" id="tot" /></td>
-
</tr>
-
</table>
2 1498
ok so i got this to work
but i need to calculate taxes.do i need to creat a var ta1 and tax 2? - <script type="text/javascript">
-
function hello(){
-
var xx=eval(form1.sum1.value);
-
var yy=eval(form1.sum2.value);
-
form1.result.value=xx+yy
-
}
-
</script>
-
-
-
<script type="text/javascript">
-
-
function calcTotal(txtBox, totBox)
-
{
-
var totVal;
-
try
-
{
-
totVal = document.getElementById(totBox).value;
-
if(totVal!= null && totVal!='')
-
{
-
document.getElementById(totBox).value= eval(parseInt(document.getElementById(totBox).value) + parseInt(txtBox.value));
-
}
-
else
-
{
-
document.getElementById(totBox).value= txtBox.value;
-
}
-
}
-
catch(e)
-
{}
-
}
-
</script>
got the tax..but as soon as i add the code for auto suggest tax stops and auto works?? - <script type="text/javascript">
-
$(document).ready(function(){
-
$('#calx').calx({
-
autocalculate: false
-
});
-
-
$('#calculate').click(function(){
-
$('#calx').calx('update');
-
});
-
});
-
</script>
-
-
-
-
-
<style>
-
input[type="text"]{
-
width:100%;
-
}
-
td{
-
padding:5px 10px;
-
}
-
</style>
-
</head>
-
<body>
-
<form id="calx">
-
<table>
-
<thead>
-
<tr>
-
<td width="268" style="width:250px">Item Name</td>
-
<td width="162" style="width:80px">Price</td>
-
<td width="162" style="width:30px">Qty</td>
-
-
<td width="168" style="width:150px">Sub Total</td>
-
</tr>
-
</thead>
-
<tbody>
-
<tr>
-
<td><input id="item1" type="text" name="item[]" value=""/></td>
-
<td><input id="price1" type="text" name="price[]" value="" data-format="$ 0,0[.]00" /></td>
-
<td><input id="qty1" type="text" name="qty[]" value="" data-format="0" /></td>
-
-
<td><input id="subtotal1" type="text" name="subtotal[]" value="" data-format="$ 0,0[.]00" data-formula="($price1*$qty1)" /></td>
-
</tr>
-
<tr>
-
<td><input id="item2" type="text" name="item[]" value="" /></td>
-
<td><input id="price2" type="text" name="price[]" value="" data-format="$ 0,0[.]00" /></td>
-
<td><input id="qty2" type="text" name="qty[]" value="" data-format="0" /></td>
-
-
<td><input id="subtotal2" type="text" name="subtotal[]" value="" data-format="$ 0,0[.]00" data-formula="($price2*$qty2)" /></td>
-
</tr>
-
<tr>
-
<td><input id="item3" type="text" name="item[]" value="" /></td>
-
<td><input id="price3" type="text" name="price[]" value="" data-format="$ 0,0[.]00" /></td>
-
<td><input id="qty3" type="text" name="qty[]" value="" data-format="0" /></td>
-
-
<td><input id="subtotal3" type="text" name="subtotal[]" value="" data-format="$ 0,0[.]00" data-formula="($price3*$qty3)" /></td>
-
</tr>
-
<tr>
-
<td><input id="item4" type="text" name="item[]" value="" /></td>
-
<td><input id="price4" type="text" name="price[]" value="" data-format="$ 0,0[.]00" /></td>
-
<td><input id="qty4" type="text" name="qty[]" value="" data-format="0" /></td>
-
-
<td><input id="subtotal4" type="text" name="subtotal[]" value="" data-format="$ 0,0[.]00" data-formula="($price4*$qty4)" /></td>
-
</tr>
-
<tr>
-
<td><input id="item5" type="text" name="item[]" value="" /></td>
-
<td><input id="price5" type="text" name="price[]" value="" data-format="$ 0,0[.]00" /></td>
-
<td><input id="qty5" type="text" name="qty[]" value="" data-format="0" /></td>
-
-
<td><input id="subtotal5" type="text" name="subtotal[]" value="" data-format="$ 0,0[.]00" data-formula="($price5*$qty5)" /></td>
-
</tr>
-
-
<tr>
-
<td height="39"> </td>
-
<td>Total Price : </td>
-
<td colspan="2"><input id="total" type="text" name="total" value="" data-format="$ 0,0[.]00" data-formula="($subtotal1+$subtotal2+$subtotal3+$subtotal4+$subtotal5)" /></td>
-
-
</tr>
-
<tr>
-
<td height="29"> </td>
-
<td>Tax1:</td>
-
<td colspan="2"><input id="totaltax1" type="text" name="totaltax" value="" data-format="$ 0,0[.]00" data-formula="($total+($total*5.00/100))" /></td>
-
-
</tr>
-
<tr>
-
<td height="29"> </td>
-
<td>Tax2:</td>
-
<td colspan="2"><input id="totaltax2" type="text" name="totaltax" value="" data-format="$ 0,0[.]00" data-formula="($total+($total*9.975/100))" /></td>
-
-
</tr>
-
<tr>
-
<td height="42"><input id="calculate" type="button" value="calculate" /></td>
-
<td>Tax in :</td>
-
<td colspan="2"><input id="totaltax" type="text" name="totaltax" value="" data-format="$ 0,0[.]00" data-formula="($total+($total*5.00/100+$total*9.975/100))" /></td>
-
-
</tr>
-
</tbody>
-
</table>
-
</form>
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Phil Powell |
last post by:
Relevancy scores are normally defined by a MySQL query on a table that
has a fulltext index. The rules for relevancy scoring will exclude
certain words due to their being too short (minimum default is 4
letters).
This is the Fed. Everything is a TLA (three-letter acronym).
Therefore, since I'm building a PORTABLE web application, changing
MySQL's default settings for fulltext index querying is completely
undoable and unrealistic, so...
|
by: Building Blocks |
last post by:
Hi,
All I need is a simle calculate form script which contains this:
A script that can handle text input, radio buttons, checkboxes, and
dropdowns. Each one of these variables will contain a number. That number
will appear in a seperate box at the bottom. So basically whatever you choose
has a corresponding number associated with it (except for the text input,
which you enter whatever number) and those numbers are added and produced in...
|
by: Jan Szymczuk |
last post by:
I'm creating an MS Access 2000 database where I have a number of people
entered using simple basic fields, Surname: SMITH
Forenames: John
DoB: 09/09/1958
Age: (this needs to be automated to show years e.g. 46)
I am trying to get the age to be automatically shown after a persons DoB
(date of birth) is entered into the DoB field. I have tried using this
formula in the Control Source of the Age field...
|
by: Libber39 |
last post by:
Hi everyone,
Have a query on how to calculate the amount of weeks and days contained in a number in an access query. ie: the difference in days between 2 dates amounts to 17 days. I want to now calculate in the query the amount of weeks and days within the 17 days to show 2 weeks 3 days.
I can create the function within excel, (A1 as cell with the days within it) as:
=INT(A1/7) & " Weeks, " & MOD(A1,7) & " days"
but cant seem to...
|
by: SuzK |
last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are
Week Ending (date)
ItemNbr (double)
Sales Dollars (double)
Sales Units (double)
Promo (Text) -- is null or "X"
AvgWklyDollars (double)
AvgWklyUnits (double)
I have a vba module which I thought would work, but it doesn't. I think the problem is an embedded SQL Totals Top 8 query, which doesn't...
| |
by: rrstudio2 |
last post by:
I am using the following vba code to calculate the median of a table
in MS Access:
Public Function MedianOfRst(RstName As String, fldName As String) As
Double
'This function will calculate the median of a recordset. The
field must be a number value.
Dim MedianTemp As Double
Dim RstOrig As Recordset
Set RstOrig = CurrentDb.OpenRecordset(RstName, dbOpenDynaset)
|
by: mzovko20 |
last post by:
Hello !
I´m having problem with this. I already created index.html document which allows user to input his/her date of birth. It looks like this :
<html>
<body>
<center>
<h3>How old are you ??</h3>
<table border="0" width="25%">
<form action="calculate.php" method="get">
<td bgcolor="#FFCC00 ">Your name</td>
<td><input type="text" name="name" maxlength="20" value="name"></td>
|
by: Big P |
last post by:
Hello,
I would like to calculate cells in DataGridView ( VB Express)
My datagridview1 looks something like this.
--------------------------------------…
Row# col1 col2 col3 Col 4
--------------------------------------…
Row1 25 13 2
Row2 26 24 4
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |