function hideMenu()
{
    if(document.getElementById("navHide").style.display!="none")
    {
        document.getElementById("navHide").style.display = "none";
        document.getElementById("contentDiv").style.width = "100%";
    }
    else
    {
        document.getElementById("navHide").style.display = "inline";
        document.getElementById("contentDiv").style.width = "82%";
    }
}

function shownav()
{
	var n = document.getElementById("navHide");
	document.getElementById("user-details").style.display="none";
	document.getElementById("innr").style.display = "none";
	if(n.style.display == "block")
	{
		n.style.display = "none";
	}
	else
	{
		n.style.display = "block";
	}
}

function userDiv()
{
	var d = document.getElementById("user-details");
	if(d.style.display == "block")
	{
		document.getElementById("user-details").style.display = "none";
		document.getElementById("innr").style.display = "none";
	}
	else
	{
		document.getElementById("user-details").style.display = "block";
		document.getElementById("innr").style.display = "block";
	}
}

function submenu(Arg)
{
    var i;
	var d = document.getElementById("submenu"+Arg);
	var a = document.getElementById("angle"+Arg);
	var nol = d.getElementsByTagName('li').length;
	var dh = (35*nol)+8;
	d.style.transition = "all 1s";
	a.style.transition = "all .5s";
	if(d.style.height==dh+"px")
	{
		d.style.height = "0px";
		a.style.transform = "rotate(0deg)";
	}
	else
	{
		for(i=1; 1<=10; i++)
		{
			if(i==Arg)
			{	
				d.style.height = dh+"px";
				document.getElementById("angle"+i).style.transform = "rotate(90deg)";

			}
			else
			{	
				var od = document.getElementById("submenu"+i);
				od.style.height = "0px";
				document.getElementById("angle"+i).style.transform = "rotate(0deg)";
			}
		}
	}
}




function getFirmBySellerId(Arg)
{
    var AjaxName    = "Ajax11";
    var FirstOption = Arg;
    if(FirstOption=="ALL")
	{
	    var SellerId  = "SellerId";
	    var FirmPlace = "FirmPlace";
	}
	else
	{
	    var SellerId  = "SellerId2";
	    var FirmPlace = "FirmPlace2";
	}
	
	var SellerId    = document.getElementById(SellerId).value;			            
	var xmlhttpFirm = new XMLHttpRequest();
	xmlhttpFirm.open("GET","Ajax.php?AjaxName="+AjaxName+"&FirstOption="+FirstOption+"&SellerId="+SellerId, false)
	xmlhttpFirm.send(null);
	document.getElementById(FirmPlace).innerHTML = xmlhttpFirm.responseText;
}


function getPaymentBySeller()
{
    var AjaxName    = "Ajax16";
	var DateType    = document.getElementById("DateType").value;
	var mdate       = document.getElementById("mdate").value;
	var ydate       = document.getElementById("ydate").value;
	var SellerId    = document.getElementById("SellerId").value;
	var FirmId      = document.getElementById("FirmPlace").value;
	var GroupBy     = document.getElementById("GroupBy").value;
	if(DateType=="MONTHWISE")
	{
	    var fdate = ydate+"-"+mdate+"-01";
	    var ldate = ydate+"-"+mdate+"-31";
	}
	else
	{   
	    var fdate = document.getElementById("fdate").value;
	    var ldate = document.getElementById("ldate").value;
	}
	
	var xmlhttpFirm = new XMLHttpRequest();
	xmlhttpFirm.open("GET","Ajax.php?AjaxName="+AjaxName+"&fdate="+fdate+"&ldate="+ldate+"&SellerId="+SellerId+"&FirmId="+FirmId+"&GroupBy="+GroupBy, false)
	xmlhttpFirm.send(null);
	document.getElementById("DataTbl").innerHTML = xmlhttpFirm.responseText;    
}

function showHide()
{
    var SellerId    = document.getElementById("SellerId").value;
    if(SellerId=="ALL")
    {
        document.getElementById("showHideDoc").style.display = "inline";
    }
    else
    {
        document.getElementById("showHideDoc").style.display = "none";
    }
}

function showHideSelect()
{
    var txntype = document.getElementById("txntype").value;
    if(txntype=="BANKING")
    {
        document.getElementById("bank").style.display       = "inline";
        document.getElementById("txnInp").style.display     = "inline";
        document.getElementById("mode").style.display       = "inline";
        document.getElementById("SellerId2").style.display  = "none";
        document.getElementById("FirmPlace2").style.display = "none";
    }
    else if(txntype=="EXCHANGE")
    {
        document.getElementById("bank").style.display       = "none";
        document.getElementById("txnInp").style.display     = "none";
        document.getElementById("mode").style.display       = "none";
        document.getElementById("SellerId2").style.display  = "inline";
        document.getElementById("FirmPlace2").style.display = "inline";
    }
    else if(txntype=="CASHPAID")
    {
        document.getElementById("bank").style.display       = "none";
        document.getElementById("txnInp").style.display     = "none";
        document.getElementById("mode").style.display       = "none";
        document.getElementById("SellerId2").style.display  = "none";
        document.getElementById("FirmPlace2").style.display = "none";
    }
}


function searchType()
{
    var searchType = document.getElementById("sarchType").value;
    
    if(searchType=="USER")
    {
        document.getElementById("user").style.display = "inline";
        document.getElementById("op").style.display= "inline";
        document.getElementById("status").style.display= "inline";
        document.getElementById("SellerId").style.display= "none";
        document.getElementById("FirmPlace").style.display= "none";
        document.getElementById("inpNum").style.display= "none";
    }
    else if(searchType=="SELLER")
    {
        document.getElementById("user").style.display = "none";
        document.getElementById("op").style.display= "none";
        document.getElementById("status").style.display= "none";
        document.getElementById("SellerId").style.display= "inline";
        document.getElementById("FirmPlace").style.display= "inline";
        document.getElementById("inpNum").style.display= "inline";
    }
}

function dateType()
{
    var DateType = document.getElementById("DateType").value;
    
    if(DateType=="DATEWISE")
    {
        document.getElementById("fdate").style.display = "inline";
        document.getElementById("ldate").style.display = "inline";
        document.getElementById("mdate").style.display = "none";
        document.getElementById("ydate").style.display = "none";
    }
    else if(DateType=="MONTHWISE")
    {
        document.getElementById("fdate").style.display = "none";
        document.getElementById("ldate").style.display = "none";
        document.getElementById("mdate").style.display = "inline";
        document.getElementById("ydate").style.display = "inline";
    }
}

function getPaymentByUser()
{
    var AjaxName    = "Ajax18";
	var DateType    = document.getElementById("DateType").value;
	var mdate       = document.getElementById("mdate").value;
	var ydate       = document.getElementById("ydate").value;
	var userType    = document.getElementById("userType").value;
	var GroupBy     = document.getElementById("GroupBy").value;
	if(DateType=="MONTHWISE")
	{
	    var fdate = ydate+"-"+mdate+"-01";
	    var ldate = ydate+"-"+mdate+"-31";
	}
	else
	{   
	    var fdate = document.getElementById("fdate").value;
	    var ldate = document.getElementById("ldate").value;
	}
	var xmlhttpFirm = new XMLHttpRequest();
	xmlhttpFirm.open("GET","Ajax.php?AjaxName="+AjaxName+"&fdate="+fdate+"&ldate="+ldate+"&userType="+userType+"&GroupBy="+GroupBy, false)
	xmlhttpFirm.send(null);
	document.getElementById("DataTbl").innerHTML = xmlhttpFirm.responseText;
    
}




    function addExtAmt(Arg)
    {
        let Amt       = document.getElementById("Amt"+Arg).value;
        let addAmt    = document.getElementById("addAmt"+Arg).value;
        let TotalAmt  = parseInt(Amt) + parseInt(addAmt);
        document.getElementById("TotalAmt"+Arg).innerHTML = TotalAmt;
        document.getElementById("inp2"+Arg).value = TotalAmt;
    }

	function GenerateInvoice(Arg)
	{
	    alert("Hello Invoice");
	    let InvDate    = document.getElementById("inp1"+Arg).value;
	    let InvAmt     = document.getElementById("inp2"+Arg).value;
	    let ClinteId   = document.getElementById("inp3"+Arg).value;
	    let TimePeriod = document.getElementById("inp4"+Arg).value;
	    let firm_id    = document.getElementById("inp5"+Arg).value;
        
	    const url = "https://www.llprecharge.in/LLPRECHARGE/Admin/generate_invice3.php?InvDate="+InvDate+"&InvAmt="+InvAmt+"&ClinteId="+ClinteId+"&TimePeriod="+TimePeriod+"&firm_id="+firm_id;
        window.location.href = url;
	}