Monday, June 8, 2015

How to refresh another page using javascript?

{
window.location.href="users.php";

}

How to include a Php file?

<?php

include '../../header.php';

?>

New form using AJAX

Javascript code

function newPage()
{

window.location.href = 'users.php';


}

Php Code


<td style="text-align:center"><img src="../../img/addbutton.png" onclick="newPage();" /></td>

Delete data form using AJAX

Javascript Code

function deleteData()
{

var userid =document.getElementById('cboUser').value;
if(userid!='')
{
var url ="user_db.php?id=deleteData";
url+="&userid="+userid;


var htmlhttp_obj  = $.ajax({url:url,async:false});
alert(htmlhttp_obj.responseText);

window.location.href = 'users.php';

}
else
alert("Please select a User to DELETE!");



}

Php Code


<td style="text-align:center"><img src="../../img/deletebuuton.png" onclick="deleteData();" /></td>


Save Form data using AJAX


JavaScript Code

function validateData()
{

if(document.getElementById('txtUserNo').value=="")
alert("Please enter User No!");
else if(document.getElementById('txtUserName').value=="")
alert("Please enter User Name!");
else if(document.getElementById('txtPassword').value=="")
alert("Please enter Password!");
else if(document.getElementById('txtConPassword').value=="")
alert("Please re enter Password!");
else if(document.getElementById('cboTitle').value=="")
alert("Please select Title!");
else if(document.getElementById('txtFirstName').value=="")
alert("Please enter First Name!");
else if(document.getElementById('txtLastName').value=="")
alert("Please enter Last Name!");
else if(document.getElementById('cboDesignation').value=="")
alert("Please select Designation!");
else if(document.getElementById('txtNicNo').value=="")
alert("Please enter NIC No!");
else if(document.getElementById('cboGender').value=="")
alert("Please Select Gender!");
else if(document.getElementById('txtDateofbirth').value=="")
alert("Please Select Date of Birth!");
else if(document.getElementById('txtEmailAddress').value=="")
alert("Please enter Email Address!");
else
{
if(document.getElementById('txtPassword').value!=document.getElementById('txtConPassword').value)
alert("Passwords don't match!");
else
saveData();
}
}

function saveData()
{
var userid =document.getElementById('cboUser').value;
var userno =document.getElementById('txtUserNo').value;
var username =document.getElementById('txtUserName').value;
var passwrd =document.getElementById('txtPassword').value;
var tite =document.getElementById('cboTitle').value;
var firstname =document.getElementById('txtFirstName').value;
var lastname =document.getElementById('txtLastName').value;
var designation =document.getElementById('cboDesignation').value;
var nic =document.getElementById('txtNicNo').value;
var gender =document.getElementById('cboGender').value;
var dateofbirth =document.getElementById('txtDateofbirth').value;
var email =document.getElementById('txtEmailAddress').value;
var add1 =document.getElementById('txtAddress1').value;
var add2 =document.getElementById('txtAddress2').value;
var add3 =document.getElementById('txtAddress3').value;
var tele =document.getElementById('txtTelNo').value;

var url="user_db.php?id=savedata";
url+="&userid="+userid;
url+="&userno="+userno;
url+="&username="+username;
url+="&passwrd="+passwrd;
url+="&tite="+tite;
url+="&firstname="+firstname;
url+="&lastname="+lastname;
url+="&designation="+designation;
url+="&nic="+nic;
url+="&gender="+gender;
url+="&dateofbirth="+dateofbirth;
url+="&email="+email;
url+="&add1="+add1;
url+="&add2="+add2;
url+="&add3="+add3;
url+="&tele="+tele;

var htmlhttp_obj  = $.ajax({url:url,async:false});
alert(htmlhttp_obj.responseText);


window.location.href="users.php";
}


 Php Code

 <td style="text-align:center"><img src="../../img/save.png"  onclick="validateData();"/></td>

How to make link sub menu from directory


 <li><a href="#">Analysis</a>
            <ul>
            <li><a href="<?php echo $backwardseperator;?>MasterData/markup/markup.php" class="documents">Mark Up</a></li>
            <li><a href="<?php echo $backwardseperator;?>MasterData/uom/uom.php" class="documents">UOM</a></li>
            <li><a href="<?php echo $backwardseperator;?>MasterData/uom/uom.php" class="documents">Analysis</a></li>
            </ul>
            </li>

How to make a menu to site

<ul class="menu">

  <li><a href="<?php echo $backwardseperator;?>main.php">Home</a></li>


   <li><a href="#">Administration</a>
            <ul>
<li><a href="<?php echo $backwardseperator;?>MasterData/user/users.php" class="documents">User</a></li>
<li><a href="<?php echo $backwardseperator;?>MasterData/designation/designation.php" class="documents">Designation</a></li>
            </ul>
            </li>
            <li><a href="#">Key Account</a>
            <ul>
            <li><a href="<?php echo $backwardseperator;?>MasterData/clientinfo/clientinfo.php" class="documents">Client Info</a></li>
            <li><a href="<?php echo $backwardseperator;?>MasterData/consultantinfo/consultantinfo.php" class="documents">Consultant Info</a></li>
            <li><a href="<?php echo $backwardseperator;?>MasterData/contractorinfo/contractorinfo.php" class="documents">Contractor Info</a></li>
            <li><a href="<?php echo $backwardseperator;?>MasterData/materialsupplierinfo/materialsupplierinfo.php" class="documents">Material Supplier Info</a></li>
            </ul>
            </li>
</ul>

How to put a text field in html



<tr>
              <td height="12" class="normalfnt">E-mail Address<span class="compulsoryRed">*</span></td>
              <td><input name="txtEmailAddress" type="text" class="txtbox" style="width:148px"  id="txtEmailAddress"  tabindex="2"/></td>


</tr>

How to put data from database to Combo box



<select name="cboDesignation" class="txtbox" id="cboDesignation" style="width:150px" tabindex="1">
<option value="">Select One</option>
                    <?php
$sql="SELECT intDesignationId,strDesignation from designation WHERE  intDesignationStatus=0";
$result = $db->RunQuery($sql);
while($row = mysql_fetch_array($result))

{
        ?>
<option value="<?php echo $row['intDesignationId']; ?>"><?php echo $row['strDesignation']; ?></option>
               
                 <?php
}

?>
                </select>

How to write mandatory fields on html?


 <span class="compulsoryRed">*</span></td>
<tdheight="12" class="normalfnt">Confirm Password

This is the Mandatory html code.
<span class="compulsoryRed">*</span>

This is the Css style of compulsoryRed.

.compulsoryRed
{
color:#F00;
}


User Details from


Delete data from database php code-User details from

if($id=='deleteData')
{
$userid = $_GET['userid'];


$sql ="UPDATE user SET intUserStatus=1 WHERE  id='$userid' ";
$result = $db->RunQuery($sql);

if($result)
echo "Deleted Successfully";

else
echo "Deletion Failed";
}

Get data from Database php Code-User details from

if($id=='getdata')
{
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$ResponseXML = "<XMLgetuser>";

$userid = $_GET['userid'];
$sql = "SELECT username,
email,
intUserNo,
strTitle,
strFirst,
strLast,
strDesignation,
strNic,
strGender,
dtmDate,
strAdd1,
strAdd2,
strAdd3,
intTele
from user WHERE id='$userid'
";

$result = $db->RunQuery($sql);
while($row=mysql_fetch_array($result))
{
$ResponseXML .= "<intUserNo><![CDATA[" . $row["intUserNo"]  . "]]>                   </intUserNo>\n";
$ResponseXML .= "<username><![CDATA[" . $row["username"]  . "]]></username>\n";
$ResponseXML .= "<strTitle><![CDATA[" . $row["strTitle"]  . "]]></strTitle>\n";
$ResponseXML .= "<strFirst><![CDATA[" . $row["strFirst"]  . "]]></strFirst>\n";
$ResponseXML .= "<strLast><![CDATA[" . $row["strLast"]  . "]]></strLast>\n";
$ResponseXML .= "<strDesignation><![CDATA[" . $row["strDesignation"]  . "]]></strDesignation>\n";
$ResponseXML .= "<strNic><![CDATA[" . $row["strNic"]  . "]]></strNic>\n";

$ResponseXML .= "<strGender><![CDATA[" . $row["strGender"]  . "]]></strGender>\n";
$ResponseXML .= "<dtmDate><![CDATA[" . $row["dtmDate"]  . "]]></dtmDate>\n";
$ResponseXML .= "<email><![CDATA[" . $row["email"]  . "]]></email>\n";
$ResponseXML .= "<strAdd1><![CDATA[" . $row["strAdd1"]  . "]]></strAdd1>\n";
$ResponseXML .= "<strAdd2><![CDATA[" . $row["strAdd2"]  . "]]></strAdd2>\n";
$ResponseXML .= "<strAdd3><![CDATA[" . $row["strAdd3"]  . "]]></strAdd3>\n";
$ResponseXML .= "<intTele><![CDATA[" . $row["intTele"]  . "]]></intTele>\n";


}
$ResponseXML .= "</XMLgetuser>";
echo $ResponseXML;
}

Savedata to Database php code-User details form

if($id=='savedata')
{
$userid = $_GET['userid'];
$userno = $_GET['userno'];
$username = $_GET['username'];
$passwrd = md5($_GET['passwrd']);
$conpasswrd = $_GET['conpasswrd'];
$tite = $_GET['tite'];
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$designation = $_GET['designation'];
$nic = $_GET['nic'];
$gender = $_GET['gender'];
$dateofbirth = $_GET['dateofbirth'];
$email = $_GET['email'];
$add1 = $_GET['add1'];
$add2 = $_GET['add2'];
$add3 = $_GET['add3'];
$tele = $_GET['tele'];

if($userid=="")
$sql="INSERT INTO user (username,email,password,intUserNo,strTitle,strFirst,strLast,strDesignation,strNic,strGender,dtmDate,strAdd1,strAdd2,strAdd3,intTele)  VALUES('$username','$email','$passwrd',$userno,'$tite','$firstname','$lastname','$designation','$nic','$gender',
'$dateofbirth','$add1','$add2','$add3',$tele)";
else
$sql="UPDATE user SET username='$username',email='$email',intUserNo=$userno,strTitle='$tite'
 ,strFirst='$firstname',strLast='$lastname',strDesignation='$designation',strNic='$nic',strGender='$gender',
 dtmDate='$dateofbirth',strAdd1='$add1',strAdd2='$add2',strAdd3='$add3',intTele=$tele  WHERE id='$userid' ";

$result=$db->RunQuery($sql);

if($result)
echo "Saved Successfully";
else
echo "Saving Failed";


}

Session start of User details form-Php Code

<?php
session_start();
$backwardseperator = "../../";
include "../../Connector.php";
header('Content-Type: text/xml');

$id=$_GET['id'];
$userId = $_SESSION["UserID"];

?>

Redirect to New form of User details form-Java script

function newPage()
{

window.location.href = 'users.php';

}

Delete data of User details from-Java scrpt

function deleteData()
{

var userid =document.getElementById('cboUser').value;
if(userid!='')
{
var url ="user_db.php?id=deleteData";
url+="&userid="+userid;


var htmlhttp_obj  = $.ajax({url:url,async:false});
alert(htmlhttp_obj.responseText);

window.location.href = 'users.php';

}
else
alert("Please select a User to DELETE!");


}

Getdata from database file of user details form-Java script

function getData()
{
var userid =document.getElementById('cboUser').value;
if(userid!='')
{
var url ="user_db.php?id=getdata";
url+="&userid="+userid;

var htmlhttp_obj  = $.ajax({url:url,async:false});

var XMLintUserNo = htmlhttp_obj.responseXML.getElementsByTagName("intUserNo");
document.getElementById('txtUserNo').value = XMLintUserNo[0].childNodes[0].nodeValue;

var XMLusername=htmlhttp_obj.responseXML.getElementsByTagName("username");
document.getElementById('txtUserName').value =XMLusername[0].childNodes[0].nodeValue;

var XMLstrTitle=htmlhttp_obj.responseXML.getElementsByTagName("strTitle");
document.getElementById('cboTitle').value =XMLstrTitle[0].childNodes[0].nodeValue;

var XMLstrFirst = htmlhttp_obj.responseXML.getElementsByTagName("strFirst");
document.getElementById('txtFirstName').value = XMLstrFirst[0].childNodes[0].nodeValue;

var XMLstrLast=htmlhttp_obj.responseXML.getElementsByTagName("strLast");
document.getElementById('txtLastName').value =XMLstrLast[0].childNodes[0].nodeValue;

var XMLstrDesignation=htmlhttp_obj.responseXML.getElementsByTagName("strDesignation");
document.getElementById('cboDesignation').value =XMLstrDesignation[0].childNodes[0].nodeValue;

var XMLstrNic=htmlhttp_obj.responseXML.getElementsByTagName("strNic");
document.getElementById('txtNicNo').value =XMLstrNic[0].childNodes[0].nodeValue;

var XMLstrGender=htmlhttp_obj.responseXML.getElementsByTagName("strGender");
document.getElementById('cboGender').value =XMLstrGender[0].childNodes[0].nodeValue;

var XMLdtmDate = htmlhttp_obj.responseXML.getElementsByTagName("dtmDate");
document.getElementById('txtDateofbirth').value = XMLdtmDate[0].childNodes[0].nodeValue;

var XMLemail=htmlhttp_obj.responseXML.getElementsByTagName("email");
document.getElementById('txtEmailAddress').value =XMLemail[0].childNodes[0].nodeValue;

var XMLstrAdd1 = htmlhttp_obj.responseXML.getElementsByTagName("strAdd1");
document.getElementById('txtAddress1').value = XMLstrAdd1[0].childNodes[0].nodeValue;

var XMLstrAdd2=htmlhttp_obj.responseXML.getElementsByTagName("strAdd2");
document.getElementById('txtAddress2').value =XMLstrAdd2[0].childNodes[0].nodeValue;

var XMLstrAdd3=htmlhttp_obj.responseXML.getElementsByTagName("strAdd3");
document.getElementById('txtAddress3').value =XMLstrAdd3[0].childNodes[0].nodeValue;

var XMLintTele=htmlhttp_obj.responseXML.getElementsByTagName("intTele");
document.getElementById('txtTelNo').value =XMLintTele[0].childNodes[0].nodeValue;



}

else
{
document.getElementById('txtUserNo').value = "";
document.getElementById('txtUserName').value = "";
document.getElementById('txtPassword').value = "";
document.getElementById('cboTitle').value = "";
document.getElementById('txtFirstName').value = "";
document.getElementById('txtLastName').value = "";
document.getElementById('cboDesignation').value = "";
document.getElementById('txtNicNo').value = "";

document.getElementById('cboGender').value = "";
document.getElementById('txtDateofbirth').value = "";
document.getElementById('txtEmailAddress').value = "";
document.getElementById('txtAddress1').value = "";
document.getElementById('txtAddress2').value = "";
document.getElementById('txtAddress3').value = "";
document.getElementById('txtTelNo').value = "";


}


}

Savedata user details form-Javascript

function saveData()
{
var userid =document.getElementById('cboUser').value;
var userno =document.getElementById('txtUserNo').value;
var username =document.getElementById('txtUserName').value;
var passwrd =document.getElementById('txtPassword').value;
var tite =document.getElementById('cboTitle').value;
var firstname =document.getElementById('txtFirstName').value;
var lastname =document.getElementById('txtLastName').value;
var designation =document.getElementById('cboDesignation').value;
var nic =document.getElementById('txtNicNo').value;
var gender =document.getElementById('cboGender').value;
var dateofbirth =document.getElementById('txtDateofbirth').value;
var email =document.getElementById('txtEmailAddress').value;
var add1 =document.getElementById('txtAddress1').value;
var add2 =document.getElementById('txtAddress2').value;
var add3 =document.getElementById('txtAddress3').value;
var tele =document.getElementById('txtTelNo').value;

var url="user_db.php?id=savedata";
url+="&userid="+userid;
url+="&userno="+userno;
url+="&username="+username;
url+="&passwrd="+passwrd;
url+="&tite="+tite;
url+="&firstname="+firstname;
url+="&lastname="+lastname;
url+="&designation="+designation;
url+="&nic="+nic;
url+="&gender="+gender;
url+="&dateofbirth="+dateofbirth;
url+="&email="+email;
url+="&add1="+add1;
url+="&add2="+add2;
url+="&add3="+add3;
url+="&tele="+tele;

var htmlhttp_obj  = $.ajax({url:url,async:false});
alert(htmlhttp_obj.responseText);


window.location.href="users.php";





}

Validate user deatils Form-JavaScript

function validateData()
{

if(document.getElementById('txtUserNo').value=="")
alert("Please enter User No!");
else if(document.getElementById('txtUserName').value=="")
alert("Please enter User Name!");
else if(document.getElementById('txtPassword').value=="")
alert("Please enter Password!");
else if(document.getElementById('txtConPassword').value=="")
alert("Please re enter Password!");
else if(document.getElementById('cboTitle').value=="")
alert("Please select Title!");
else if(document.getElementById('txtFirstName').value=="")
alert("Please enter First Name!");
else if(document.getElementById('txtLastName').value=="")
alert("Please enter Last Name!");
else if(document.getElementById('cboDesignation').value=="")
alert("Please select Designation!");
else if(document.getElementById('txtNicNo').value=="")
alert("Please enter NIC No!");
else if(document.getElementById('cboGender').value=="")
alert("Please Select Gender!");
else if(document.getElementById('txtDateofbirth').value=="")
alert("Please Select Date of Birth!");
else if(document.getElementById('txtEmailAddress').value=="")
alert("Please enter Email Address!");
else
{
if(document.getElementById('txtPassword').value!=document.getElementById('txtConPassword').value)
alert("Passwords don't match!");
else
saveData();
}
}

User details form-Html code

<body>
<?php
include '../../header.php';
?>
<table width="550" border="0" align="center">
    <tr>
<td width="62%"><table width="100%" border="0" class="tableBorder">
          <tr>
                <td colspan="3" class="normalfnt" style="text-align:center" bgcolor="#00CC33" height="30"><font color="#FFFFFF" size="2">Users</font></td>
          </tr>
        <tr>
          <td height="96">
            <table width="100%" border="0">
             
              <tr>
                <td colspan="2" class="normalfnt">&nbsp;</td>
                <td width="50%">&nbsp;</td>
              </tr>
              <tr>
                <td width="17%" rowspan="20" class="normalfnt">&nbsp;</td>
                <td width="33%" height="11" class="normalfnt">Search User</td>
                <td><select name="cboUser" class="txtbox" id="cboUser" style="width:150px" tabindex="1" onchange="getData();">
                  <option value="">Select One</option>
                   <?php
$sql="SELECT id,username from user WHERE  intUserStatus=0";
$result = $db->RunQuery($sql);
while($row = mysql_fetch_array($result))
{
 ?>
                  <option value="<?php echo $row['id']; ?>"><?php echo $row['username']; ?></option>
                  
                  <?php
}

?>
                </select></td>
              </tr>
              <tr>
                <td height="12" class="normalfnt">User No<span class="compulsoryRed">*</span></td>
                <td><input name="txtUserNo" type="text" class="txtbox" style="width:148px"  id="txtUserNo" maxlength="" onkeypress="return checkForTextNumber(this.value, event);" tabindex="2"/></td>
              </tr>
               <tr>
                 <td height="12" class="normalfnt">User Name<span class="compulsoryRed">*</span></td>
                 <td><input name="txtUserName" type="text" class="txtbox" style="width:148px"  id="txtUserName" maxlength="" tabindex="2"/></td>
               </tr>
               <tr>
                 <td height="12" class="normalfnt">Password<span class="compulsoryRed">*</span></td>
                 <td><input name="txtPassword" type="password" class="txtbox" style="width:148px"  id="txtPassword" maxlength="" tabindex="2"/></td>
               </tr>
               <tr>
                 <td height="12" class="normalfnt">Confirm Password<span class="compulsoryRed">*</span></td>
                 <td><input name="txtConPassword" type="password" class="txtbox" style="width:148px"  id="txtConPassword" maxlength="" tabindex="2"/></td>
               </tr>
               <tr>
                 <td height="12" class="normalfnt">Title<span class="compulsoryRed">*</span></td>
                 <td><select name="cboTitle" class="txtbox" id="cboTitle" style="width:75px" tabindex="1">
                   <option value="">Select One</option>
                   <option value="Mr">Mr</option>
                   <option value="Mrs">Mrs</option>
                   <option value="Miss">Miss</option>
                 </select></td>
               </tr>
               <tr>
                 <td height="12" class="normalfnt">First Name<span class="compulsoryRed">*</span></td>
                 <td><input name="txtFirstName" type="text" class="txtbox" style="width:148px"  id="txtFirstName" maxlength="" tabindex="2"/></td>
               </tr>
               
               <tr>
                 <td height="12" class="normalfnt">Last Name<span class="compulsoryRed">*</span></td>
                 <td><input name="txtLastName" type="text" class="txtbox" style="width:148px"  id="txtLastName" maxlength="" tabindex="2"/></td>
               </tr>
                <tr>
                  <td height="12" class="normalfnt">Designation<span class="compulsoryRed">*</span></td>
                  <td><select name="cboDesignation" class="txtbox" id="cboDesignation" style="width:150px" tabindex="1">
                    <option value="">Select One</option>
                    <?php
$sql="SELECT intDesignationId,strDesignation from designation WHERE  intDesignationStatus=0";
$result = $db->RunQuery($sql);
while($row = mysql_fetch_array($result))
{
 ?>
                  <option value="<?php echo $row['intDesignationId']; ?>"><?php echo $row['strDesignation']; ?></option>
                  
                  <?php
}

?>
                  </select></td>
                </tr>
                <tr>
                  <td height="12" class="normalfnt">NIC No<span class="compulsoryRed">*</span></td>
                  <td><input name="txtNicNo" type="text" class="txtbox" style="width:148px"  id="txtNicNo" maxlength="10" tabindex="2"/></td>
               </tr>
                <tr>
                  <td height="12" class="normalfnt">Gender<span class="compulsoryRed">*</span></td>
                  <td><select name="cboGender" class="txtbox" id="cboGender" style="width:75px" tabindex="1">
                    <option value="">Select One</option>
                    <option value="Male">Male</option>
                    <option value="Female">Female</option>
                  </select></td>
                  </tr>
                 
                 
            <tr>
             
                  <td height="12" class="normalfnt">Date of Birth<span class="compulsoryRed">*</span></td>
                  <td><input name="txtDateofbirth" style="width:148px; text-align:left" type="text" maxlength="100" class="txtbox" id="txtDateofbirth" size="10" onmousedown="DisableRightClickEvent();" onmouseout="EnableRightClickEvent();" onkeypress="return ControlableKeyAccess(event);" value="<?php echo date('Y-m-d');?>" onclick="return showCalendar(this.id, '%Y-%m-%d');"/><input type="reset" value=""  class="txtbox" style="visibility:hidden;"   onclick="return showCalendar(this.id, '%Y-%m-%d');" /></td>
               </tr>
            <tr>
              <td height="12" class="normalfnt">E-mail Address<span class="compulsoryRed">*</span></td>
              <td><input name="txtEmailAddress" type="text" class="txtbox" style="width:148px"  id="txtEmailAddress"  tabindex="2"/></td>
            </tr>
            <tr>
              <td height="12" class="normalfnt">Address 1</td>
              <td><input name="txtAddress1" type="text" class="txtbox" style="width:148px"  id="txtAddress1"  tabindex="2"/></td>
            </tr>
            <tr>
              <td height="12" class="normalfnt">Address 2</td>
              <td><input name="txtAddress2" type="text" class="txtbox" style="width:148px"  id="txtAddress2"  tabindex="2"/></td>
            </tr>
            <tr>
              <td height="12" class="normalfnt">Address 3</td>
              <td><input name="txtAddress3" type="text" class="txtbox" style="width:148px"  id="txtAddress3"  tabindex="2"/></td>
            </tr>
            <tr>
              <td height="12" class="normalfnt">Telephone No</td>
              <td><input name="txtTelNo" type="text" class="txtbox" style="width:148px"  id="txtTelNo"  tabindex="2" maxlength="10"/></td>
            </tr>
         
 <tr>
   <td colspan="2" class="normalfnt">&nbsp;<span id="txtHint" style="color:#FF0000"></span></td>
   </tr>
            </table>            </td>
        </tr>
        <tr>
         
         
        </tr>
       
        <tr>
          <td height="34"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="bcgl1">
              <tr>
                <td width="100%" bgcolor=""><table width="100%" border="0" class="tableFooter">
                    <tr>
                      <td width="10%">&nbsp;</td>
                      <td >&nbsp;</td>
                      <td style="text-align:center"><img src="../../img/addbutton.png" onclick="newPage();" /></td>
                      <td style="text-align:center"><img src="../../img/save.png"  onclick="validateData();"/></td>
 <td style="text-align:center"><img src="../../img/deletebuuton.png" onclick="deleteData();" /></td>
                      <td style="text-align:center"><img src="../../img/cancelbutton.png" /></td>
                      <td width="15%">&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
          </table></td>
        </tr>
      </table></td>
      </tr>
    </table>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
</tr>
</div>
</body>


Logout php code

<?php
session_start();

session_unset();
session_destroy();

echo '<META HTTP-EQUIV="Refresh" Content="0; URL=login.php">';

?>

Database connection

<?php
session_start();
include "DBManager.php";
$db =  new DBManager();
//$db->SetConnectionString($_SESSION["Server"],$_SESSION["UserName"],$_SESSION["Password"],$_SESSION["Database"]);
$db->SetConnectionString('localhost','root','','quatationdb');

/*SetConnectionString('localhost','dutyfree_lathika','windows','dutyfree_apparel');*/
?>

Login page -Design



This the interface of Login page.
Login page html code is here.Table structure.

<table width="550" border="0" align="center" style="margin-top:300px">
    <tr>
   <td width="62%"><table width="100%" border="0" class="tableBorder">
     <tr>
   <td colspan="3" class="normalfnt" style="text-align:center" bgcolor="#00CC33" height="30">        <font color="#FFFFFF" size="2">LOGIN</font></td>
          </tr>
          <tr>
          <td height="96">
           <table width="100%" border="0">
              <tr>
              <td colspan="2" class="normalfnt">&nbsp;</td>
              <td width="50%">&nbsp;</td>
              </tr>
              <tr>
                <td width="17%" rowspan="20" class="normalfnt">&nbsp;</td>
                <td width="33%" height="11" class="normalfnt">User Name</td>
                 <td><input name="txtUser" type="text" class="txtbox" style="width:148px"  id="txtUser" maxlength=""  tabindex="2"/></td>
              </tr>
              <tr>
               <td height="12" class="normalfnt">Password<span class="compulsoryRed">*</span>                         </td>

                <td>
              <input name="txtPassWord" type="password" class="txtbox" style="width:148px"                              id="txtPassWord" maxlength=""                                                                      tabindex="2"onKeyPress="EnableEnterKeySubmission(event);"/></td>
             
               <td style="text-align:right" rowspan="2"><img src="img/secrecy-icon.png"
width="148" height="103" onclick="SubmitDetails();" /></td>

              </tr>
       
       <tr>
     <td colspan="2" class="normalfnt">&nbsp;<span id="txtHint" style="color:#FF0000"></span></td>
    </tr>
            </table>          
            </td>
            </tr>
               <tr>

        </tr>
         <tr>
          <tr>
          </table>
         </td>
           </tr>
          </table>

Login page

Login page php code

   <?php

if($_SESSION['UserID']!='')
{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=main.php">';
}
?>
<?php

$UserName = $_POST["txtUser"];
$userCheck = 0;
if ($UserName != null)
{
$Password =  $_POST["txtPassWord"];


$db =  new LoginDBManager();
$SQL = "SELECT
`user`.id,
`user`.username,
`user`.email,
`user`.`password`
FROM
user` WHERE username='$UserName' AND password='".md5($Password)."';";
$SQL ="SELECT UserID FROM users where UserName='". $UserName."' and                                    Password='". md5($Password) ."';";

echo $SQL;
$result = $db->RunQuery($SQL);
$validUser = false;

$db = NULL;
if(mysql_num_rows($result)>0)
{
while($row = mysql_fetch_array($result))
{

$_SESSION["UserID"] = $row["id"];
$_SESSION["UserName"] = $row["username"];
$_SESSION["Password"] = $row["password"];
}
echo '<META HTTP-EQUIV="Refresh" Content="0;                                                                              URL=main.php">';
}
else
//$userCheck= "User Name / Password Error";
echo "<script>alert('User Name / Password Error')</script>";

}?>



Conclusion

This chapter will conclude the dissertation with a critical evaluation of the system and suggestions for future work. The chapter will discuss extend of the project objectives were satisfied and the reasons for them. Experience gain during the course of the project will also be expanded on this chapter. 

Evaluation

This chapter will be provided detail about testing of system was done including with comprehensive test plan that was used to verify and validate the system. This will be included detail of wide range of test data. Evidence will be provided to show that all aspects of the system have been tested and specification has been met. Descriptions of the effects of various kinds of errors and the required system behavior upon occurrence of an error have included. The evaluation of the system with potential users will also be provided here. 

Implementation

This chapter will be described the implementation of the system with the identification and explanation of all major code and module structures. Also, the implementation environment (hardware and software), any existing code that was reused, development tools used, and platform dependence will be discussed. 

Design

The structure of the overall system will be clear discussed in this chapter including methodical approach to the design of the system, alternate solutions and the one selected. And there will be explanation and justification with respect to the selection. Coherent and logical arguments are encouraged. The correct use of appropriate tools and techniques will be demonstrated. User interface design will also be discussed in this chapter.

Analysis

This chapter is provides the detailed and specific requirements of the system plus explanation of design decisions and made are stated. Initial situation of the system with reference to requirement analysis, project goals and limitation of goals with respect to the system environment will also be described and Existing similar systems are discussed here. Description of the prerequisites that must apply for the system to be used (called success factors), specification of the number of users, the frequency of use, and the jobs of the users, and example will be described. Functional requirements covering system functionality expected by the users and non-functional requirements covering reliability, portability, and response and processing times will be addressed with detailed justification.

Stucture

This will contain the outline of chapters of the dissertation which are gathered from during the creating period of web based price quotation and profitability analyze system.

There is few steps.

  1. ANALYSIS
  2. DESIGN
  3. IMPLEMENTATION
  4. EVALUATION
  5. CONCLUSION

Proposed way of self-evaluating the success


  •  The extent to which the new system will support to the client for enhancing quality, productivity and efficiency with compared to existing manual system, by the client feedback and acceptance.



  • Report generating facilities, performance and effectiveness of all reports are provided to each different users and system user’s system comment.



  • Performance of central database, and backup system.



  • Speed, accuracy, accessibility of new system compared to existing manual system

Resource requirements-Software

Software requirements

Server:


  • Windows or Linux operating System having a Web browser application that supports JavaScript
  • MySQL Server 5.0
  • Apache Server 2.0


Client:


  • Windows or Linux operating System having a Web browser application that supports JavaScript
  • Application software to open exchanging document ( MS office )

Resource requirements

Hardware requirements

Server:

  •  Pentium III (or above) processor/ speed 800MHz (or above)
  • 512MB RAM (or above)
  • 20GB Hard drive space
  • CD-ROM Drive



Client:

  • Pentium III (or above) processor/ speed 800MHz (or above)
  •  20GB Hard drive space
  • CD-ROM Drive
  • 512MB RAM (or above)

Itemized list of deliverables


  • The developed web base system for preparing price quotation easily with help as soft copy written on CD.


  • Duly completed project report to the client


  •  Duly completed user manual & tutorials as a soft copy written on CD & hard copy.


  • Developed database system as soft copy written on CD


  • Supportive software as soft copy written on CD
  •  Installation & system configuration manual as soft copy written on CD & hard copy

Critical functionalities


  •  Computerize the all manual system which are currently used by client and provide efficient and effective web base multi user system to enter all related information into a centralized data base to prepare price quotations.



  •  Provide comprehensive reports to analyze operational & maintenance performance in a developing system.



  •  Implement preventive maintenance procedure to minimize breakdown of the services a in system.



  • Dedicated inventory management system for maintaining necessary tools and material which are required for, maintain a syste

Scope

The system is a multiple user web based system consisting of several sub systems to provide specific user views with necessary facilities for deferent users.


  • The system will be provided a central database, which is having following documents & details with proper access controlling mechanism.
                          


o Price Details
o Material Detail
o Technical specification
o Log Details


  • The system will provided decision support system provided to administration.

  •  Implementing web based pricing system to get best price proposal including all necessary details

  • Generating proper price proposal report

  •  Provide customer supportive document (User manual)

  •  Provide facility for upgrading the system

Objectives


  • To provide accurate, competitive price quotation for customer need


  • To provide informative data


  • Preparing attractive report including similar nature of project past experience qualification of the company.


  • Provide management information such as, profitability analysis including direct indirect cost profit and overhead component.


  • Get the optimum use of company recourses


  • Improve the quality efficiency and effectiveness of company pricing operations

Sunday, June 7, 2015

Problem Domain


The client main business main activities going through the preparation of price quotation. And there also no such method to calculate the final profit or loss in the completed project. Therefore the client required a Web Based Price Quotation & Profitability Analyze System for their business.

During the preliminary interview with the managing director of the company, I have recently realized that their current manual system has become inefficient and time consuming due to the increasing complexity of the price quotation work. And also the company usually use the some computer application for prepare the price quotation such as Microsoft Excel , Microsoft word. The manual system was maintained through the computer data base, use to keep record of the source document.

The record of the company used to prepare the price quotation was changed by day by day, because of the fast development of the industry. Prices of the material, skilled labor charge, any other information was dramatically change. Due to those reasons have to maintain  updated data base.


Therefore this web based Price Quotation & Profitability Analyze system was built to make a  contribution to the productivity and profitability enhancement of the company.

What is Company?

Smart Design And Construction (Pvt) Ltd is a multi-disciplinary company, which provides total solution to the property development industry for designing, project management, construction and maintenance. Qualified group of energetic professionals drives the core business of the company. Excellence of the business was achieved by the set of innovative tools, simulation with powerful software and correct application of technology for optimize solutions.   There vision was Establish the sustainability through innovative solution. Their main business activities was,

1)      Stainless steel works including hand railing, staircase and railing, balcony railing, lift lobby and lift interior.
2)      Steel structures including working platform, steel roof, canopies, staircase, water and fuel tank, rainwater gutters.
3)      Aluminum cladding works ,tempered glass solution
4)      Office interior solutions including partitioning, carpeting ,Power , Data, intercom 
5)      Ceilings