June 11, 2004 at 2:16 am
iam from india, and our date format is dd/mm/yyyy
yesterday when our operators were making invoice entry for the month of june
suppose they entered date 01/06/04
it was automatically get transfered to 06/01/04
and there is one report where specify the period for the invoice report.
and when the operators type 01/06/04 to 10/06/04
the report is coming haywire,
it is showing report from month 1 to month 10
iam not sure whats the problem , what do i need to do, becoz there is going to be a demo and if the reports are displayed this way it will cause serious problems for me,
what i did was i in the invoice entry i
fired one sql command
con.Execute "SET DateFormat dmy"
will this cause any further problems
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
June 11, 2004 at 3:27 am
I don't think I can help u but what is the data type of the column where the date is stored.
What is the Regional short date format on the server hosting the website?
What is the Regional short date format on the server with SQL Ser?
Or you using a Calendar controll for the date.
Make sure that DEV test & Production have the same date formats.
Andy.
June 11, 2004 at 5:04 am
well the problem
is my dates are getting reversed from dd/mm to mm/dd
ADO is changing it i suppose
our date format is dd/mm/yyyy.
and our user types dd/mm/yyyy, previously it was working fine
dates were getting properly inserted
now just for this month(month of june) invoices entered are having wrong date values
like i suppose the date typed is 04/06/2004
it is getting reversed to 06/04/2004
and in the invoice reports when the period is mentioned
from 01/06/2004 to 10/06/2004
it is not showing in this report
but when date is mentiond this way 06/01/2004 to 10/06/04
it is showing there.
i tried to force dd/mm/yyyy format to ADO
using " set dateformat dmy"
just after opening data connection
i fried this query
con.Execute "SET DateFormat dmy"
it works on my computer but not on the webserver in which our site is hosted, its showing error of out of range values and
dates are still getting reversed stored
any solution for this
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
June 11, 2004 at 5:14 am
Please send me the code where the user sets the date. What is the datatype in SQL Server?
Andy.
June 11, 2004 at 5:40 am
datatype is datetime 8
i dont think source code will be very useful
but u requested it so take it
-----------------------------------
<%
RMCPL=getvalue
set con=server.createobject("ADODB.connection")
con.Open RMCPL
set rsopt=server.createobject("Adodb.recordset")
set rsopt1=server.createobject("Adodb.recordset")
if Request.QueryString("flag") "" then
con.Execute "SET DateFormat dmy"
set dbrec=server.createobject("Adodb.recordset")
dbrec.Open " Select * from Invoice where INVOICE_NO ='" & Request.Form("invno") & "' and Invoice_Type='" & Request.QueryString("InvoiceType") & "'",con,1,3
if dbrec.EOF then
dbrec.AddNew
dbrec("Invoice_Type")=Request.Form("InvoiceType")
dbrec("Invoice_No")=Request.Form("invno")
dbrec("Invoice_date")=Request.Form("invdt")
dbrec("Invoice_CUSTCODE")=Request.Form("cust")
dbrec("Invoice_PRODUCT")=Request.Form("Product1")
dbrec("Invoice_QTY")=Request.Form("Qty1")
if Request.Form("basic") "" then
dbrec("Invoice_TRMG")=Request.Form("basic")
end if
if Request.Form("excise") "" then
dbrec("Invoice_EXCISE")=Request.Form("excise")
end if
dbrec("Invoice_ST")=Request.Form("salestax")
if Request.Form("other") "" then
dbrec("Invoice_OTHERCHARGES")=Request.Form("other")
end if
if Request.Form("comm") "" then
dbrec("Invoice_COM_PAYABLE")=Request.Form("comm")
end if
'dbrec("Invoice_ST")=Request.Form("salestax")
if Request.Form("narr") "" then
dbrec("Invoice_NARRATION")=Request.Form("narr")
end if
dbrec("Invoice_DUEDT")=Request.Form("duedt")
dbrec("Invoice_DUEDT1")=Request.Form("duedt")
dbrec("Invoice_TOTAL")=Request.Form("total")
dbrec("Invoice_AMT1")=Request.Form("total")
dbrec.Update
MSG=1
else
msg=2
end if
end if
%>
<script>
function check_date(field){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = "/";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
err = 0;
DateValue = DateField.value;
/* Delete all chars except 0..9 */
for (i = 0; i = 0) {
DateTemp = DateTemp + DateValue.substr(i,1);
}
}
DateValue = DateTemp;
/* Always change date to 8 digits - string*/
/* if year is entered as 2-digit / always assume 20xx */
if (DateValue.length == 6) {
DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
if (DateValue.length != 8) {
err = 19;}
/* year is wrong if year = 0000 */
year = DateValue.substr(4,4);
if (year == 0) {
err = 20;
}
/* Validation of month*/
month = DateValue.substr(2,2);
if ((month 12)) {
err = 21;
}
/* Validation of day*/
day = DateValue.substr(0,2);
if (day 29)) {
err = 23;
}
if ((month == 2) && (leap != 1) && (day > 28)) {
err = 24;
}
/* Validation of other months */
if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
err = 25;
}
if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
err = 26;
}
/* if 00 ist entered, no error, deleting the entry */
if ((day == 0) && (month == 0) && (year == 00)) {
err = 0; day = ""; month = ""; year = ""; seperator = "";
}
/* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
if (err == 0) {
DateField.value = day + seperator + month + seperator + year;
}
/* Error-message if err != 0 */
else {
alert("Date is incorrect!");
DateField.select();
DateField.focus();
return;
}
}
function onleve(a)
{
if(isNaN(a.value)==true || a.value < 0 || a.value=="") a.value=0;
}
function validate(){
if(document.f1.InvoiceType.value=="NA")
{
alert("Please Select Invoice Type");
document.f1.InvoiceType.focus();
return false;
}
if(document.f1.invno.value=="")
{
alert("Please Enter Invoice No");
document.f1.invno.focus();
return false;
}
if(document.f1.invdt.value=="")
{
alert("Please Enter Invoice Date");
document.f1.invdt.focus();
return false;
}
if(document.f1.total.value=="")
{
alert("Please Enter Total Value");
document.f1.total.focus();
return false;
}
if(document.f1.duedt.value=="")
{
alert("Please Enter Due Date");
document.f1.duedt.focus();
return false;
}
}
</script>
<%if request.querystring("flag")"" then%>
<script language = javascript>
alert("Invoice Inserted Successfully");
document.location ="MAINMENU.ASP";
</script>
<script language = javascript>
alert("Invoice No already exists.");
history.back();
</script>
Invoice
| Invoice Type | Select Invoice Type RMC MFG RMC TR RMC EXP RMC PRO SCPL MFG SCPL TR SCPL EXP SCPL PRO * | ||||
Invoice No | * | |||||
Invoice Date | (DD/MM/YYYY) * | |||||
Customer Name | Select Customer <option value=> * | |||||
Product | Select Product <option value=> * | |||||
Quantity | * | |||||
Basic Value | ||||||
Exicse Duty Payable | ||||||
Sales Tax | ||||||
Other Charges | ||||||
Total Value | ||||||
Commission Payable | ||||||
Narration | ||||||
Due Date | (DD/MM/YYYY) | |||||
<!--CANCEL--> |
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply