Jump to content

coding help


ricky_vancouver

Recommended Posts

The code below is part of a working program which inserts "tentpay" and date paid. I'm trying to add the code which is below the comment line(//*). It does nothing? can someone look at it?

 

 

 

 

function calculate_paid(v)

{

var rentdue = document.getElementById("rentdue");

var prevbal = document.getElementById("prevbal");

var misc = document.getElementById("misc");

var late = document.getElementById("late");

var amtpaid = document.getElementById("amtpaid");

var tentpay = document.getElementById("tentpay");

var hudpay = document.getElementById("hudpay");

var datepaid = document.getElementById("datepaid");

var late = document.getElementById("late");

var dateNow = new Date();

var dayNow = dateNow.getDate();

var datePaid = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear();

switch(v)

{

  case amtpaid:

  var tpay = amtpaid.value - hudpay.value;

  if(tpay >= 0){tentpay.value = tpay;}

  if(amtpaid.value > 0){datepaid.value = datePaid;}

  break;

  case tentpay:

  if(!hudpay.value || hudpay.value == " "){hudpay.value = 0;}

  if(!tentpay.value || tentpay.value == " "){tentpay.value = 0;tentpay.select();}

  amtpaid.value = parseInt(tentpay.value) + parseInt(hudpay.value);

  if(tentpay.value > 0){datepaid.value = datePaid;}

  break;

  case hudpay:

  if(!tentpay.value || tentpay.value == " "){tentpay.value = 0;}

  if(!hudpay.value || hudpay.value == " "){hudpay.value = 0;hudpay.select();}

  amtpaid.value = parseInt(tentpay.value) + parseInt(hudpay.value);

  if(hudpay.value > 0){datepaid.value = datePaid;}

  break;

//*

  case prevbal:

  var balance = parseInt(rentdue.value) + parseInt(prevbal.value) + parseInt(misc.value) - parseInt(hudpay.value);

  if(amtpaid.value < balance.value){

  prevbal.value = parseInt(balance.value) - parseInt(amtpaid.value);}

  if(dayNow.value > 5){late.value = "L";

  prevbal.value = prevbal.value + 10;}

  break;

  }

    }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.