-- cshtml
@{
Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
<style>
.modal-dialog {
width: 75%;
}
.ui-jqgrid .ui-jqgrid-labels {
height: 43px !important;
}
</style>
<script src="@Url.Content("~/Scripts/MsoScripts/Transactions/SubscriberSTBRouterDetails.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap-switch.js")"></script>
<link href="~/Content/Css/bootstrap-switch.css" rel="stylesheet" />
<div ng-app="RMS" ng-controller="SubscriberSTBRouterCtrl" ng-init="DatepickerEnableStatus();LoadSubscirberData();GetPackagesDetails();GetData();GetGridData();">
<div class="page-content">
<div class="row">
<div class="col-xs-12 col-sm-12">
<form name="subscriberSTBRdetails" novalidate class="form-horizontal">
<div class="col-md-12">
<div>
<h5 class="widget-title red dark-10 no-padding " style="font-size:16px; font-weight:600; margin:5px 0px;">
<i class="ace-icon fa fa-user"></i>
SUBSCRIBER SET UP BOX AND ROUTER DETAILS
</h5>
<div class="form-group">
<label class=" col-sm-2 control-label FullWidth">
Date<span style="color: Red">*</span> :
</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="Date" ng-model="STBR.datdate" placeholder="Enter Date" data-date-format="dd/mm/yyyy"
class="form-control" id="Date" required ng-disabled="DateEnableStatus" />
<span class="error" ng-show="(subscriberSTBRdetails.Date.$dirty || submitted) && subscriberSTBRdetails.Date.$error.required">
Date Required
</span>
</div>
<label class=" col-sm-2 control-label FullWidth">
Subscriber Name<span style="color: Red">*</span> :
</label>
<div class="col-sm-6">
<ui-select name="productname" id="productname" required ng-model="SubscriberSTBRouterCtrl.v.selected.vchsubscribername" on-select=" Subscriber_Change(SubscriberSTBRouterCtrl.v.selected)" title="Select Subscriber Name" ng-disabled="isdisabled" width="400">
<ui-select-match placeholder="Select Subscriber Name">{{$select.selected.vchsubscribername}}</ui-select-match>
<ui-select-choices repeat="v in subscriber | propsFilter: {vchsubscribername: $select.search,vchregistrationid: $select.search,vchmobilenumber: $select.search}">
<div ng-bind-html="v.vchsubscribername | highlight: $select.search"></div>
<small>
Subscriber Id: <span ng-bind-html="v.vchregistrationid | highlight: $select.search" style="font-family: Verdana; font-weight: bold; color: #FF6E33"></span>
Mobile No.:<span ng-bind-html="v.vchmobilenumber | highlight: $select.search" style="font-family: Verdana; font-weight: bold; color: #FF6E33"></span>
</small>
</ui-select-choices>
</ui-select>
<span class="error" ng-show="(subscriberSTBRdetails.productname.$dirty || submitted) && subscriberSTBRdetails.productname.$error.required">
Subscriber Name Required
</span>
</div>
</div>
<div class='form-group'>
<label class=" col-sm-2 control-label FullWidth">Registration ID :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtRegistrationId" ng-model="STBR.registrationid" id="txtRegistrationId" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth" ng-show="false">Subscriber Name :</label>
<div class="col-sm-3 FullWidth" ng-show="false">
<input type="text" name="txtSuscriberName" ng-model="STBR.suscribername" id="txtSuscriberName" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Mobile No. :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtMobileNo" ng-model="STBR.mobilenumber" id="txtMobileNo" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Type Of Package<span style="color:red">*</span>:</label>
<div class="col-sm-2 FullWidth">
<select id="PackageType" class=" form-control" name="PackageTypeId" kt-focus data-index="1" ng-model="STBR.PackageTypeId" ng-change="SelectRouterDetails(STBR);GetconnType();" ng-options="c.PackageTypeId as c.PackageType for c in packagetypes" ng-required="true" ng-disabled="EditDisable">
<option value="">Select Package</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.PackageTypeId.$dirty || submitted ) && subscriberSTBRdetails.PackageTypeId.$error.required">
Package Required
</span>
</div>
</div>
<div class="form-group" ng-show="false">
<h3 class="scheduler-border blue" style="font-size:12px; font-weight:600; margin:5px 0px;">
EXISTING CONNECTIONS
</h3>
</div>
<div class='form-group' ng-show="false">
<label class=" col-sm-2 control-label FullWidth">STB SD Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingSTBSD" ng-model="STBR.existingSTBSD" id="txtExistingSTBSD" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">STB HD Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingSTBHD" ng-model="STBR.existingSTBHD" id="txtExistingSTBHD" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Router Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingRouter" ng-model="STBR.existingRouter" id="txtExistingRouter" disabled />
</div>
</div>
<div class='form-group'>
<label class=" col-sm-2 control-label FullWidth">Connection Type <span style="color:red">*</span>:</label>
<div class="col-sm-3 FullWidth">
<select id="FilterConnectionType" class=" form-control" name="FilterConnectionType" kt-focus data-index="1" ng-model="STBR.ddlconnType" ng-change="ConnectionType_Change()" ng-options="c.ddlconnType as c.ddlconnType for c in lstconntype" ng-required="true" ng-disabled="EditDisable">
<option value="">Select Connection Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.FilterConnectionType.$dirty || submitted) && subscriberSTBRdetails.FilterConnectionType.$error.required">
Connection Type Required
</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 no-padding">
<fieldset class="scheduler-border ">
<legend class="scheduler-border blue">
@*<div class="checkbox" ng-show="STBR.checkboxrouter" style="width:auto; float:left;">
<label>
<input type="checkbox" value="" ng-model="STBR.chkRouter" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
</label>
</div>*@
<input type="checkbox" ng-model="STBR.chkRouter" ng-show="STBR.checkboxrouter" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<h5 style="float: right; position: relative; margin: 3px 0px 0px 3px; "><i class="fa fa-assistive-listening-systems red"></i> ROUTER DETAILS</h5>
</legend>
<div>
<div class="form-group"></div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Type<span style="color:red">{{mandataryrt}}</span>:
</label>
<div class="col-sm-8">
<select name="RouterType" ng-model="STBR.vchRouterType" ng-options="c.vchRouterType as c.vchRouterType for c in lstroutertypes" class="form-control" data-index="1" ng-change="getRouterAmountDetails(STBR);" ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter">
<option value="">Select Router Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.RouterType.$dirty || submitted) && subscriberSTBRdetails.RouterType.$error.required">
Router Type Required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Serial No.<span style="color:red">{{mandataryrt}}</span>:
</label>
<div class="col-sm-8">
@*<select name="RouterSerialNumber" ng-model="STBR.routerserialnumber" ng-options="c.routerserialnumber as c.routerserialnumber for c in lstrouterserialnumbers" class="form-control" data-index="1" ng-disabled="!STBR.chkRouter" ng-required="!STBR.chkrouter">
<option value="">Select Router Serial Number</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.routerserialnumber.$dirty || submitted) && subscriberSTBRdetails.routerserialnumber.$error.required">
Router Serial No. Required
</span>*@
<input type="text" id="routerserialnumber" class="form-control" capitalize maxlength="50"
name="RouterSerialNumber" ng-model="STBR.routerserialnumber" placeholder="Enter Router Serial No." ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter" ng-blur="GetserialnumberROUTER(STBR.routerserialnumber,STBR.vchRouterType);" />
<span class="error" ng-show="(subscriberSTBRdetails.RouterSerialNumber.$dirty || submitted) && subscriberSTBRdetails.RouterSerialNumber.$error.required">
Router Serial No. required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Warranty(Months)<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="rtrwarranty" style="text-align:right" ng-model="STBR.rtrwarranty" placeholder="Enter Warranty(Months)" kit-digits maxlength="2"
class="form-control" id="rtrwarranty" ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter" />
<span class="error" ng-show="(subscriberSTBRdetails.rtrwarranty.$dirty || submitted) && subscriberSTBRdetails.rtrwarranty.$error.required">
Router Warranty required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Amount<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="rtramount" ng-model="STBR.rtramount" style="text-align:right" placeholder="Enter Router Amount" disabled
class="form-control" id="rtramount" />
</div>
</div>
</div>
</fieldset>
</div>
<div class="col-sm-6 no-padding">
<fieldset class="scheduler-border ">
<legend class="scheduler-border blue">
@*<div class="checkbox" ng-show="STBR.checkboxsetupbox" style="width:auto; float:left;">
<label>
<input type="checkbox" value="" ng-model="STBR.chkSTB" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
</label>
</div>*@
<input type="checkbox" ng-model="STBR.chkSTB" ng-show="STBR.checkboxsetupbox" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<h5 style="float: right; position: relative; margin: 3px 0px 0px 3px; "><i class="fa fa-assistive-listening-systems red"></i>SETUP BOX DETAILS</h5>
</legend>
<div>
<div class="form-group"></div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Type<span style="color:red">{{mandatarystb}}</span>:
</label>
<div class="col-sm-8">
<select name="STBType" ng-model="STBR.vchSTBType" ng-options="c.vchSTBType as c.vchSTBType for c in lststbtypes" class="form-control" data-index="1" ng-change="getSTBAmountDetails(STBR);" ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB">
<option value="">Select STB Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.STBType.$dirty || submitted) && subscriberSTBRdetails.STBType.$error.required">
STB Type Required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Serial No.<span style="color:red">{{mandatarystb}}</span>:
</label>
<div class="col-sm-8">
@*<select name="STBSerialNumber" ng-model="STBR.stbserialnumber" ng-options="c.stbserialnumber as c.stbserialnumber for c in lststbserialnumbers" class="form-control" data-index="1" ng-disabled="!STBR.chkSTB" ng-required="!STBR.chkSTB">
<option value="">Select STB Serial Number</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.stbserialnumber.$dirty || submitted) && subscriberSTBRdetails.stbserialnumber.$error.required">
STB Serial No. Required
</span>*@
<input type="text" id="stbserialnumber" class="form-control" capitalize maxlength="50"
name="STBSerialNumber" ng-model="STBR.stbserialnumber" placeholder="Enter STB Serial No." ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB" ng-blur="Getserialnumber(STBR.stbserialnumber,STBR.vchSTBType);" />
<span class="error" ng-show="(subscriberSTBRdetails.STBSerialNumber.$dirty || submitted) && subscriberSTBRdetails.STBSerialNumber.$error.required">
STB Serial No. required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Warranty(Months)<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="stbwarranty" ng-model="STBR.stbwarranty" style="text-align:right" placeholder="Enter STB Warranty(Months)" ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB"
class="form-control" id="stbwarranty" kit-digits maxlength="2" />
<span class="error" ng-show="(subscriberSTBRdetails.stbwarranty.$dirty || submitted) && subscriberSTBRdetails.stbwarranty.$error.required">
STB Warranty required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Amount<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="stbamount" ng-model="STBR.stbamount" style="text-align:right" placeholder="Enter STB Amount" disabled
class="form-control" id="stbamount" />
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installation Charges :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Installation Charges" style="text-align:right;" ng-blur="InstallaCharges(STBR.InstallationCharges);CalculateData()" name="InstallationCharges" ng-model="STBR.InstallationCharges" valid-numberr maxlength="10" ng-change="CalculateData();SetCurrency(STBR.InstallationCharges);"
ng-keydown="CalculateData();" ng-mouseleave="CalculateData();" ng-click="CalculateData();" ng-keypress="CalculateData();" ng-keyup="CalculateData();SetCurrency(STBR.InstallationCharges);" />
@*<span class="error" ng-show="(subscriberSTBRdetails.InstallationCharges.$dirty || submitted) && subscriberSTBRdetails.InstallationCharges.$error.required">
Installation Charges Required
</span>*@
</div>
</div>
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installation Date <span style="color: Red">*</span>:</label>
<div class="col-sm-7 FullWidth">
<input type="text" name="InstallationDate" id="InstallationDate" readonly ng-model="STBR.installationdate" placeholder="Enter Date" data-date-format="dd/mm/yyyy"
class="form-control" required ng-change="getInstallationDate(STBR);" />
<span class="error" ng-show="(subscriberSTBRdetails.InstallationDate.$dirty || submitted) && subscriberSTBRdetails.InstallationDate.$error.required">
Date Required
</span>
</div>
</div>
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installed By <span style="color: Red">*</span>:</label>
<div class="col-sm-7 FullWidth">
<select name="EmpName" ng-model="STBR.EmployeeName" ng-options="c.EmployeeName as c.EmployeeName for c in lstemployeename" class="form-control" data-index="1" required>
<option value="">Select Name</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.EmpName.$dirty || submitted) && subscriberSTBRdetails.EmpName.$error.required">
Installed By Required
</span>
</div>
</div>
</div>
<div class='form-group'>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Deposit Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" ng-blur="Desposeamt();" placeholder="Enter Deposit Amount" ng-change="SetCurrencyAdvance(STBR.AdvanceAmount);" style="text-align:right;" name="AdvanceAmount" ng-model="STBR.AdvanceAmount" valid-numberr maxlength="10" />
</div>
</div>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Total Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" ng-blur="totalamt();" placeholder="Enter Total Amount" style="text-align:right;" name="TotalAmount" ng-model="STBR.TotalAmount" kit-amount disabled />
</div>
</div>
</div>
<div class='form-group'>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Discount Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Discount Amount" ng-blur="discountamt();CalculateData();" style="text-align:right;" name="DiscountAmount" ng-model="STBR.DiscountAmount" valid-numberr maxlength="10" ng-change="CalculateData();SetCurrencyDiscount(STBR.DiscountAmount);" ng-keydown="CalculateData();" ng-mouseleave="CalculateData();" ng-click="CalculateData();" ng-keypress="CalculateData();" ng-keyup="CalculateData();" />
<span class="error">{{STBR.alertamount}}</span>
@*<span class="error" ng-show="(subscriberSTBRdetails.DiscountAmount.$dirty || submitted) && subscriberSTBRdetails.DiscountAmount.$error.required">
Discount Name Required
</span>*@
</div>
</div>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Total Amount after Discount:</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Total Amount" ng-blur="totalamtaftrdst();" style="text-align:right;" name="TotalAmountafterDiscount" ng-model="STBR.TotalAmountafterDiscount" valid-numberr disabled />
<span class="error">{{STBR.alertTotalamount}}</span>
</div>
</div>
</div>
<div class='form-group'>
<div class="pull-right">
<button class="btn btn-success" data-index="3" type="button" ng-click="SaveSTBRTRDetails()">
<i class="ace-icon fa fa-plus bigger-110"></i>Save
</button>
<button class=" btn btn-danger" ng-click="ResetSubscriberSTBRTRDetails()">
<i class="fa fa-times"></i>Reset
</button>
</div>
</div>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #5499C7;">
<button type="button" ng-click="BoostClear()" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" style="align-content:center" id="myModalLabel">Subscriber STB & Router Details</h4>
</div>
<div class="modal-body">
<div class="form-group">
<span class="col-sm-4 control-labe">Connection ID : <span style="color:red">{{connectionid}}</span></span>
<span class="col-sm-4 control-labe">Subscriber Name : <span style="color:red">{{subscribername}}</span></span>
<span class="col-sm-4 control-labe">Mobile No. : <span style="color:red">{{mobilenumber}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Package Type : <span style="color:red">{{packagetype}}</span></span>
@*<span class="col-sm-3 control-labe">Package Type:<span style="color:red">{{packagetype}}</span></span>*@
<span class="col-sm-4 control-labe">Connection Type : <span style="color:red">{{connectiontype}}</span></span>
<span class="col-sm-4 control-labe" ng-show="invisiblerouter">Router Type : <span style="color:red">{{routertype}}</span></span>
</div>
<div class="form-group" ng-show="invisiblerouter">
<span class="col-sm-4 control-labe">Router No. : <span style="color:red">{{routernumber}}</span></span>
<span class="col-sm-4 control-labe">Router Warranty : <span style="color:red">{{routerwarranty}}</span></span>
<span class="col-sm-4 control-labe">Router Amount : <span style="color:red">{{routeramount}}</span></span>
</div>
<div class="form-group" ng-show="invisiblestb">
<span class="col-sm-4 control-labe">STB Type : <span style="color:red">{{stbtype}}</span></span>
<span class="col-sm-4 control-labe">STB No. : <span style="color:red">{{stbnumber}}</span></span>
<span class="col-sm-4 control-labe">STB Warranty(In Months) : <span style="color:red">{{stbwarranty}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe" ng-show="invisiblestb">STB Amount : <span style="color:red">{{stbamount}}</span></span>
<span class="col-sm-4 control-labe">Installation Charges : <span style="color:red">{{installationcharges}}</span></span>
<span class="col-sm-4 control-labe">Installed By : <span style="color:red">{{installedby}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Installation Date : <span style="color:red">{{Installationdate}}</span></span>
<span class="col-sm-4 control-labe">Discount Amount : <span style="color:red">{{discountamount}}</span></span>
<span class="col-sm-4 control-labe">Total Amount : <span style="color:red">{{tatalamount}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Deposit Amount : <span style="color:red">{{advanceamount}}</span></span>
<span class="col-sm-4 control-labe" ng-show="false">Total Amount After Discount : <span style="color:red">{{totalamountafterdiscount}}</span></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="clearfix"></div>
<table id="gridsubscriberSTBRTRdetails"></table>
<div id="grid-pager">
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//SubscriberSTBRouterCtrl as
var appElement = document.querySelector('[ng-controller=SubscriberSTBRouterCtrl]');
function Search() {
;
JqCustomSearch($("#globalSearchText").val(), $("#gridsubscriberSTBRTRdetails"))
}
function ViewRow(row) {
;
//var $http = angular.element(appElement).injector().get('$http');
//var $scope = angular.element(appElement).scope();
var appElement = document.querySelector('[ng-controller=SubscriberSTBRouterCtrl]');
var $http = angular.element(appElement).injector().get('$http');
var $scope = angular.element(appElement).scope();
var rowdata = jQuery("#gridsubscriberSTBRTRdetails").jqGrid('getRowData', row);
//var copy = Object.assign({}, rowdata);
// $scope.ADON = copy;
$scope.GetGridData();
if (rowdata.packagetype == "ISP") {
$scope.invisiblestb = false;
$scope.invisiblerouter = true;
}
else if (rowdata.packagetype == "CABLE") {
$scope.invisiblestb = true;
$scope.invisiblerouter = false;
}
else {
$scope.invisiblestb = true;
$scope.invisiblerouter = true;
}
;
//$scope.connectionid = $scope.connectionid;
$scope.connectionid = rowdata.connectionid;
//$scope.packagetype = $scope.ADON.PackageType;
$scope.subscribername = rowdata.suscribername;
$scope.mobilenumber = rowdata.mobilenumber;
$scope.packagetype = rowdata.packagetype;
$scope.connectiontype = rowdata.connectiontype;
$scope.routertype = rowdata.rtbtype;
$scope.routernumber = rowdata.routerserialnumber;
$scope.routerwarranty = rowdata.rtrwarranty;
$scope.routeramount = rowdata.rtramount;
$scope.stbtype = rowdata.stbtype;
$scope.stbnumber = rowdata.stbserialnumber;
$scope.stbwarranty = rowdata.stbwarranty;
$scope.stbamount = rowdata.stbamount
//$scope.packagetype = $scope.ADON.PackageType;
$scope.installationcharges = rowdata.InstallationCharges;
$scope.installedby = rowdata.employeename;
$scope.Installationdate = rowdata.installationdate;
$scope.advanceamount = rowdata.Advanceamount;
$scope.discountamount = rowdata.Discountamount;
$scope.tatalamount = rowdata.numtotalamount;
$scope.totalamountafterdiscount = rowdata.numtotalamount;
$('#myModal1').modal('show');
$scope.$apply();
//$http.post('/CableMastres/CheckBoostupEditName/', rowdata).success(function (data) {
// ;
// if (data == 1) {
// ;
// //$scope.BoostupbtnSave = "Update";
// //$scope.SetAddonPackageNames(copy);
// //$scope.setfixedorpaisa(copy);
// //$scope.EditDisable = true;
// //$scope.GetPackagesTypes($scope.PG);
// //$scope.GetPackageNames();
// //$scope.GetAmountDurationOnEdit(copy);
// //$scope.GetaAmount(copy);
// //$scope.$apply();
// //$scope.fixedpaisa_change();
// // init();
// }
// else {
// alert("Cannot Update Package as it is in use by the application");
// }
//})
}
app.directive('validNumberr', function () {
return {
require: '?ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
if (!ngModelCtrl) {
return;
}
ngModelCtrl.$parsers.push(function (val) {
if (angular.isUndefined(val)) {
var val = '';
}
var clean = val.replace(/[^0-9\.,]/g, '');
var decimalCheck = clean.split('.');
if (!angular.isUndefined(decimalCheck[1])) {
decimalCheck[1] = decimalCheck[1].slice(0, 2);
clean = decimalCheck[0] + '.' + decimalCheck[1];
}
if (val !== clean) {
ngModelCtrl.$setViewValue(clean);
ngModelCtrl.$render();
}
return clean;
});
element.bind('keypress', function (event) {
if (event.keyCode === 32) {
event.preventDefault();
}
});
}
};
});
</script>
<script type="text/javascript">
$(function () {
//$('.Search-Select').searchable();
$("#Date").datepicker();
// $('#Date').datepicker('setEndDate', 'today');
$("#InstallationDate").datepicker();
//$("#InstallationDate").datepicker("setDate", 'today');
// $('#installationdate').datepicker('setEndDate', 'today');
});
</script>
<style>
.ui-datepicker-calendar, .ui-datepicker-year {
display: none;
}
.modal-dialog {
width: 75%;
}
.ui-jqgrid .ui-jqgrid-htable th div {
height: 43px;
overflow: hidden;
padding-top: 11px;
position: relative;
vertical-align: text-top;
white-space: normal !important;
}
.ui-state-default.ui-jqgrid-hdiv {
height: 44px;
}
.ui-jqgrid tr.jqgrow td {
white-space: normal !important;
/*height: auto;
padding-top: 3px;
vertical-align: text-top;*/
}
</style>
-- js file
var app = angular.module('RMS');
app.controller('SubscriberSTBRouterCtrl', function ($scope, $http, $rootScope, $filter) {
;
$rootScope.FormName = "Subscriber Set Up Box And Router Details";
$rootScope.ModuleName = "MSO Transactions";
var pim = this;
$scope.STBR = {};
$scope.submitted = false;
$scope.isFormValid = false;
//$scope.disableInstaDate = true;
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
$scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.lstConnectionTypes = [{ ConnectionTypeId: "1", FilterConnectionType: "PREPAID" }, { ConnectionTypeId: "2", FilterConnectionType: "POSTPAID" }];
$scope.STBR.chkRouter = false;
$scope.STBR.chkSTB = false;
var res = window.location.pathname.split("/");
var baseurl = window.location.protocol + "//" + window.location.host;
if (res.length > 3) {
for (i = 1; i < res.length - 2; i++)
baseurl = baseurl + "/" + res[i];
}
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = false;
$scope.GetGridData = [];
$scope.Getpvdate = function () {
;
var url = baseurl + "/CableTransactions/GetDate";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.billdate = data;
});
}
//var url = baseurl + "/CableTransactions/GetConnType";
//$http({
// url: url,
// method: "post"
//}).success(function (data) {
// ;
// // $scope.lstConnectionTypes = data;
//});
$scope.GetconnType = function () {
;
var url = baseurl + "/MSOReports/getConnType";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.lstconntype = data;
});
}
$scope.Getserialnumber = function (number, type) {
;
// var type; //= $scope.STBR.vchconnectiontype;
//type= $scope.STBR.vchSTBType;
var type = $scope.STBR.vchRouterType;
// if (($scope.STBR.stbserialnumber != undefined && $scope.STBR.routerserialnumber != undefined) && ($scope.STBR.stbserialnumber != "" && $scope.STBR.routerserialnumber != "")) {
if (($scope.STBR.stbserialnumber != undefined) && ($scope.STBR.stbserialnumber != "")) {
if ($scope.STBR.stbserialnumber == $scope.STBR.routerserialnumber) {
alert("Router And STB Serial Numbers Should Not be Same");
$scope.STBR.stbserialnumber = "";
}
else {
var count = 0;
var url = baseurl + "/CableTransactions/checkSerialNumbers";
$http.post(url, { type: type, number: number }).success(function (data) {
;
//count = Convert.ToInt(data);
if (data.Count > 0) {
alert(data.Message);
checkScope = false;
$scope.STBR.stbserialnumber = '';
}
else {
checkScope = true;
}
});
}
}
}
$scope.GetserialnumberROUTER = function (number, type) {
;
// var type; //= $scope.STBR.vchconnectiontype;
//type= $scope.STBR.vchSTBType;
var type = $scope.STBR.vchRouterType;
//if (($scope.STBR.stbserialnumber != undefined && $scope.STBR.routerserialnumber != undefined) && ($scope.STBR.stbserialnumber != "" && $scope.STBR.routerserialnumber != "")) {
if (($scope.STBR.routerserialnumber != undefined) && ($scope.STBR.routerserialnumber != "")) {
if ($scope.STBR.stbserialnumber == $scope.STBR.routerserialnumber) {
alert("Router And STB Serial Numbers Should Not be Same");
$scope.STBR.routerserialnumber = "";
}
else {
var count = 0;
var url = baseurl + "/CableTransactions/checkSerialNumbers";
$http.post(url, { type: type, number: number }).success(function (data) {
;
//count = Convert.ToInt(data);
if (data.Count > 0) {
alert(data.Message);
checkScope = false;
$scope.STBR.routerserialnumber = '';
}
else {
checkScope = true;
}
});
}
}
}
function GetSelectedDate(date) {
;
try {
if (date != "" && date != null && date != "Invalid Date")
return date.getDate() + '-' + (parseInt(date.getMonth()) + 1) + '-' + date.getFullYear();
else
return null;
} catch (e) {
alert(e.message);
}
}
function GetFormatedDate(date) {
;
try {
if (date != "" && date != null && date != "Invalid Date") {
if (date.search("/") > 0)
var parts = date.split("/");
else if (date.search("-") > 0)
var parts = date.split("-");
return new Date(parts[2], parts[1] - 1, parts[0]);
}
else
return null;
} catch (e) {
alert(e.message);
}
}
$scope.ConnectionType_Change = function () {
$scope.STBR.installationdate = null;
if ($scope.STBR.ddlconnTypeid == "1") {
$scope.Getpvdate();
}
}
$scope.getInstallationDate = function () {
;
var InstallationDate = GetFormatedDate($scope.STBR.installationdate);
var BillGenerationDate = GetFormatedDate($scope.billdate);
//$(function () {
// ;
// //alert("1");
// $("#InstallationDate").datepicker("minDate", BillGenerationDate);
// $("#InstallationDate").datepicker("maxDate", InstallationDate);
//});
if ($scope.STBR.ddlconnTypeid == "1") {
if (InstallationDate != null && BillGenerationDate != null) {
if (InstallationDate < BillGenerationDate) {
;
alert("Installation Date Should be Greate Than or Equal to " + GetSelectedDate(BillGenerationDate));
$scope.STBR.installationdate = null;
$scope.STBR.installationdate = [];
}
}
}
}
$scope.ClearSubscriberSTBRTRDetails = function () {
;
try {
;
$scope.STBR = {};
$scope.subscriberSTBRdetails.$setPristine();
pim.v = {};
$scope.submitted = false;
$scope.isFormValid = false;
$scope.CalculateData();
$scope.DatepickerEnableStatus();
location.reload();
} catch (e) {
alert(e.message);
}
}
$scope.ClearSubscriberSTBRTRDetails1 = function () {
;
try {
;
$scope.STBR = {};
$scope.lstconntype = [];
$scope.subscriberSTBRdetails.$setPristine();
$scope.submitted = false;
$scope.isFormValid = false;
$scope.CalculateData();
$scope.STBR.DiscountAmount = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.InstallationCharges = 0;
$scope.STBR.rtramount = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.TotalAmount = 0;
$scope.STBR.TotalAmountafterDiscount = 0;
} catch (e) {
alert(e.message);
}
}
$scope.$watch('subscriberSTBRdetails.$valid', function (newValue) {
$scope.isFormValid = newValue;
});
$scope.GetData = function () {
var url = baseurl + "/CableTransactions/GetData";
$http({ url: url, method: 'Get' }).success(function (data) {
;
if (data.length != 0) {
$scope.lstAllData = data;
}
});
}
//****************** DATE PICKER ENABLE AND DISABLE STATUS *******************************//
$scope.DatepickerEnableStatus = function () {
;
var url = baseurl + "/Login/GetDatepickerEnableStatus";
$http({
url: url,
method: "get"
}).success(function (data) {
;
if (data.Status != null) {
if (data.Status === "Y") {
$scope.DateEnableStatus = false;
} else {
$scope.DateEnableStatus = true;
}
}
else {
$scope.DateEnableStatus = true;
}
if (data.ServerDate != null) {
;
$scope.STBR.datdate = data.ServerDate;
$scope.STBR.installationdate = data.ServerDate;
var date1 = $scope.STBR.datdate;
$(function () {
;
//alert("1");
$("#Date").datepicker("setEndDate", date1);
$("#InstallationDate").datepicker("setEndDate", date1);
});
}
});
}
//****************** DATE PICKER ENABLE AND DISABLE STATUS *******************************//
//****************** GET PACKAGE TYPES *******************************//
$scope.GetPackagesDetails = function () {
var url = baseurl + "/CableMastres/GetPackageTypes";
$http({ url: url, method: 'Get' }).success(function (data) {
;
if (data.length != 0) {
$scope.packagetypes = data;
}
});
}
//****************** GET PACKAGE TYPES *******************************//
//****************** BIDING SUBSCRIBER NAMES AND RESPECTIVE TEXT BOXES ON THE SUBSCRIBER CHANGE *******************************//
$scope.LoadSubscirberData = function () {
;
$scope.STBR.DiscountAmount = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.InstallationCharges = 0;
$scope.STBR.rtramount = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.TotalAmount = 0;
$scope.STBR.TotalAmountafterDiscount = 0;
var url = baseurl + "/CableTransactions/GetSubscriberIdName";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.subscriber = data;
//console.log(data);
});
var url1 = baseurl + "/Login/ShowEmployeeName";
$http.get(url1).success(function (data) {
;
$scope.lstemployeename = eval('(' + data.Data + ')');
});
}
$scope.Subscriber_Change = function (subschaged) {
;
var found = false;
$scope.ClearSubscriberSTBRTRDetails1();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
var val = subschaged.vchsubscribername.vchregistrationid;
angular.forEach($scope.subscriber, function (tag) {
if (val.indexOf(tag.vchregistrationid) != -1) {
;
$scope.STBR.registrationid = subschaged.vchsubscribername.vchregistrationid;
$scope.STBR.suscribername = subschaged.vchsubscribername.vchsubscribername;
$scope.STBR.mobilenumber = subschaged.vchsubscribername.vchmobilenumber;
$scope.STBR.existingSTBSD = subschaged.vchsubscribername.ExistingSDSTB;
$scope.STBR.existingSTBHD = subschaged.vchsubscribername.ExistingHDSTB;
$scope.STBR.existingRouter = subschaged.vchsubscribername.ExitsingRouter;
}
});
return found;
}
//****************** BIDING SUBSCRIBER NAMES AND RESPECTIVE TEXT BOXES ON THE SUBSCRIBER CHANGE *******************************//
//****************** BINDING STB AND ROUTER NUMBERS AND THEIR AMOUNTS FROM MSO *******************************//
$scope.SelectRouterDetails = function () {
;
$scope.lstconntype = [];
$scope.STBR.InstallationCharges = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.DiscountAmount = 0;
$scope.STBR.chkSTB = false;
$scope.STBR.stbtype = null;
$scope.STBR.stbserialnumber = null;
$scope.STBR.stbwarranty = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.chkRouter = false;
$scope.STBR.routerserialnumber = null;
$scope.STBR.rtrwarranty = 0;
$scope.STBR.rtramount = 0;
$scope.lststbtypes = {};
$scope.lstroutertypes = {};
if ($scope.STBR.PackageTypeId == "1") {
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = true;
}
else if ($scope.STBR.PackageTypeId == "2") {
$scope.STBR.checkboxrouter = true;
$scope.STBR.checkboxsetupbox = false;
}
else if ($scope.STBR.PackageTypeId == "3") {
$scope.STBR.checkboxrouter = true;
$scope.STBR.checkboxsetupbox = true;
}
else {
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = false;
}
$scope.CalculateData();
}
//****************** BINDING STB AND ROUTER NUMBERS AND THEIR AMOUNTS FROM MSO *******************************//
//****************** BINDING STB AND ROUTER SERIAL NUMBERS AND THEIR WARRANTY FROM MMS *******************************//
$scope.getSTBRTRSerialNumbersMMS = function () {
;
//$scope.STBR.stbamount = null;
//$scope.STBR.rtramount = null;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.DiscountAmount = 0;
// $scope.STBR.InstallationCharges = null;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if ($scope.STBR.chkRouter == true) {
// $scope.STBR.rtrwarranty = null;
$scope.mandataryrt = "*";
;
if ($scope.lstAllData != null || $scope.lstAllData !== undefined) {
;
$scope.lstroutertypes = {};
var lsttypes = [];
for (var i = 0; i < $scope.lstAllData.length; i++) {
if ($scope.lstAllData[i].vchpackagename === pkgType && $scope.lstAllData[i].vchcombodata === 'ISP') {
var routerTypes = { vchRouterType: $scope.lstAllData[i].vchRouterType };
lsttypes.push(routerTypes);
}
}
$scope.lstroutertypes = lsttypes;
}
var url = baseurl + "/CableTransactions/getSTBRTRDetailsfromMMS";
$http.post(url, { PackageTypeId: $scope.STBR.PackageTypeId }).success(function (data) {
;
$scope.lststbserialnumbers = data;
});
}
else {
$scope.mandataryrt = "";
$scope.STBR.rtramount = 0;
// $scope.STBR.InstallationCharges = null;
$scope.STBR.routerserialnumber = null;
$scope.STBR.rtrwarranty = 0;
$scope.STBR.vchRouterType = '';
if ($scope.stbamtA2 == undefined && $scope.stbamtA1 == undefined)
{
$scope.stbamtA2 = 0;
$scope.stbamtA1 = 0;
}
if ($scope.stbamtA2 == 0 && $scope.stbamtA1 == 0) {
$scope.STBR.InstallationCharges = 0;
}
else if ($scope.stbamtA2 == 0 && $scope.stbamtA1 != 0) {
// $scope.stbamt -= $scope.stbamtA1;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA2);
$scope.stbamtA1 = 0;
}
else {
$scope.stbamt -= $scope.stbamtA1;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
$scope.stbamtA1 = 0;
}
}
if ($scope.STBR.chkSTB == true) {
// $scope.STBR.stbwarranty = null;
$scope.mandatarystb = "*";
;
if ($scope.lstAllData != null || $scope.lstAllData !== undefined) {
;
$scope.lststbtypes = {};
var lsttypes = [];
//var pro = $scope.lstAllData.map(function (obj) { return obj.vchSTBType; });
//$scope.lststbtypes = pro.filter(function (v, i) { return pro.indexOf(v) == i; });
for (var i = 0; i < $scope.lstAllData.length; i++) {
if ($scope.lstAllData[i].vchpackagename === pkgType && $scope.lstAllData[i].vchcombodata === 'CABLE') {
var stbTypes = { vchSTBType: $scope.lstAllData[i].vchSTBType };
lsttypes.push(stbTypes);
}
}
$scope.lststbtypes = lsttypes;
}
var url = baseurl + "/CableTransactions/getSTBRTRDetailsfromMMS";
$http.post(url, { PackageTypeId: $scope.STBR.PackageTypeId }).success(function (data) {
;
$scope.lststbserialnumbers = data;
});
}
else {
$scope.mandatarystb = "";
$scope.STBR.stbserialnumber = null;
$scope.STBR.stbwarranty = 0;
$scope.STBR.stbamount = 0;
// $scope.STBR.InstallationCharges = null;
$scope.STBR.vchSTBType = '';
if ($scope.stbamtA2 == undefined && $scope.stbamtA1 == undefined) {
$scope.stbamtA2 = 0;
$scope.stbamtA1 = 0;
}
if ($scope.stbamtA2 == 0 && $scope.stbamtA1 == 0) {
$scope.STBR.InstallationCharges = 0;
}
else if ($scope.stbamtA2 != 0 && $scope.stbamtA1 == 0) {
//$scope.stbamt -= $scope.stbamtA2;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA1);
$scope.stbamtA2 = 0;
}
else {
$scope.stbamt -= $scope.stbamtA2;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
$scope.stbamtA2 = 0;
}
}
$scope.CalculateData();
}
$scope.getRouterAmountDetails = function () {
;
var RouterType = $scope.STBR.vchRouterType;
$scope.stbamtA1 = 0;
$scope.stbamtA2;
$scope.stbamt = 0;
// $scope.stbamtA1 = $scope.STBR.InstallationCharges;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if (($scope.lstAllData != null || $scope.lstAllData !== undefined) && ($scope.lststbtypes != null || $scope.lststbtypes !== undefined)) {
;
var count = 0;
for (var i = 0; i < $scope.lstAllData.length; i++) {
;
if (($scope.lstAllData[i].vchpackagename === pkgType) && ($scope.lstAllData[i].vchRouterType === RouterType)) {
var rtamount = $scope.lstAllData[i].numAmount;
$scope.STBR.rtramount = $scope.CurrencyFormat(rtamount);
$scope.stbamtA1 = $scope.lstAllData[i].InstallationCharges;
count = 1;
if ($scope.stbamtA2 == null && $scope.stbamtA2 == undefined) {
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA1);
}
else {
$scope.stbamt = parseFloat($scope.stbamtA1) + parseFloat($scope.stbamtA2);
$scope.STBR.InstallationCharges = $scope.stbamt;
}
}
}
if (count == 0) {
$scope.STBR.rtramount = null;
// $scope.STBR.InstallationCharges = null;
}
}
$scope.CalculateData();
}
$scope.getSTBAmountDetails = function () {
;
var STBType = $scope.STBR.vchSTBType;
$scope.stbamtA2 = 0;
$scope.stbamtA1;
$scope.stbamt = 0;
// $scope.InstalSumAmt = $scope.STBR.InstallationCharges;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if (($scope.lstAllData != null || $scope.lstAllData !== undefined) && ($scope.lststbtypes != null || $scope.lststbtypes !== undefined)) {
;
var count = 0;
for (var i = 0; i < $scope.lstAllData.length; i++) {
;
if (($scope.lstAllData[i].vchpackagename === pkgType) && ($scope.lstAllData[i].vchSTBType === STBType)) {
var numstbamt = $scope.lstAllData[i].numAmount;
$scope.STBR.stbamount = $scope.CurrencyFormat(numstbamt);
$scope.stbamtA2 = $scope.lstAllData[i].InstallationCharges;
count = 1;
if ($scope.stbamtA1 == null && $scope.stbamtA1 == undefined) {
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA2);
}
else {
$scope.stbamt = parseFloat($scope.stbamtA2) + parseFloat($scope.stbamtA1);
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
}
}
}
if (count == 0) {
$scope.STBR.stbamount = null;
// $scope.STBR.InstallationCharges = null;
}
//else {
// $scope.InstalSumAmt = $scope.stbamt + $scope.rtamt;
//}
}
$scope.CalculateData();
}
//****************** BINDING STB AND ROUTER SERIAL NUMBERS AND THEIR WARRANTY FROM MMS *******************************//
//****************** FUNCTION FOR CALCULATING TOTALS *******************************//
$scope.CalculateData = function () {
var stbamout = $scope.STBR.stbamount;
var routeramount = $scope.STBR.rtramount;
var Instalamt = $scope.STBR.InstallationCharges;
Instalamt = String(Instalamt);
// alert(Instalamt);
var DiscountAmt = $scope.STBR.DiscountAmount;
var TotAmtafterDiscount = $scope.STBR.TotalAmountafterDiscount
if (stbamout == null || stbamout == undefined || stbamout == 'empty' || stbamout == "" || stbamout==0) {
stbamout = "0";
}
stbamout = stbamout.replace(/[^0-9\.]+/g,"");
if (routeramount == null || routeramount == undefined || routeramount == 'empty' || routeramount == "" || routeramount==0) {
routeramount ="0";
}
routeramount = routeramount.replace(/[^0-9\.]+/g, "");
if (Instalamt == null || Instalamt == undefined || Instalamt == 'empty' || Instalamt == "" || Instalamt==0) {
Instalamt ="0";
}
Instalamt = Instalamt.replace(/[^0-9\.]+/g, "");
if (DiscountAmt == null || DiscountAmt == undefined || DiscountAmt == 'empty' || DiscountAmt == "" || DiscountAmt==0) {
DiscountAmt = "0";
}
DiscountAmt = DiscountAmt.replace(/[^0-9\.]+/g, "");
var totalamt1 = $scope.STBR.TotalAmount;
if (totalamt1 == null || totalamt1 == undefined || totalamt1 == 'empty' || totalamt1 == "" || totalamt1 == 0) {
totalamt1 = "0";
}
var totalamt = totalamt1.replace(/[^0-9\.]+/g, "");
if (parseInt(DiscountAmt) > 0 || parseInt(totalamt) > 0) {
if (parseInt(DiscountAmt) > parseInt(totalamt)) {
//alert("Discount should not be Greater than or Equal to Total Amount");
$scope.STBR.alertamount = "Discount should not be Greater than Total Amount";
}
else {
$scope.STBR.alertamount = null;
//$scope.submitted = true;
//$scope.isFormValid = false;
}
var totalamtafdis = $scope.STBR.TotalAmountafterDiscount;
if (parseInt(totalamtafdis) < 0) {
//alert("Total Amount should not be Less than or Equal to Zero");
$scope.STBR.alertTotalamount = "Total Amount should not be Less than Zero";
}
else {
$scope.STBR.alertTotalamount = null;
//$scope.submitted = true;
//$scope.isFormValid = false;
}
}
var stbamtt = stbamout;
if (stbamtt == null || stbamtt == undefined || stbamtt == "" || stbamtt == 0) {
stbamtt = "0";
}
var stbamout1 = stbamtt.replace(/[^0-9\.]+/g, "");
var t1 = routeramount;
if (t1 == null || t1 == undefined || t1 == "" || t1 == 0) {
t1 = "0";
}
var routeramount1 = t1.replace(/[^0-9\.]+/g, "");
var t2 = Instalamt;
if (t2 == null || t2 == undefined || t2 == "" || t2 == 0) {
t2 = "0";
}
var Instalamt1 = t2.replace(/[^0-9\.]+/g, "");
$scope.result = parseInt(stbamout1) + parseInt(routeramount1) + parseInt(Instalamt1);
var totalamtt = $scope.result;
$scope.STBR.TotalAmount = $scope.CurrencyFormat(totalamtt);
var t3 = DiscountAmt;
if (t3 == null || t3 == undefined || t3 == "" || t3 == 0) {
t3 = "0";
}
var DiscountAmt1 = t3.replace(/[^0-9\.]+/g, "");
$scope.Finalresult = $scope.result - parseInt(DiscountAmt1);
$scope.STBR.TotalAmountafterDiscount = $scope.CurrencyFormat($scope.Finalresult);
}
//****************** FUNCTION FOR CALCULATING TOTALS *******************************//
//****************** SAVING STB RTR DEATILS *******************************//
$scope.SaveSTBRTRDetails = function () {
;
try {
var checkScope = true;
var dstamt = $scope.STBR.DiscountAmount;
if (dstamt == null || dstamt == undefined || dstamt == "" || dstamt == 0) {
dstamt = "0";
}
dstamt = dstamt.replace(/[^0-9\.]+/g, "");
var totalamt = $scope.STBR.TotalAmount;
if (totalamt == null || totalamt == undefined || totalamt == "" || totalamt == 0) {
totalamt = "0";
}
totalamt = totalamt.replace(/[^0-9\.]+/g, "");
if (parseInt(dstamt) > 0 || parseInt(totalamt) > 0) {
if (parseInt(dstamt) > parseInt(totalamt)) {
//alert("Discount should not be Greater than or Equal to Total Amount");
$scope.STBR.alertamount = "Discount should not be Greater than Total Amount";
//$scope.isFormValid = false;
checkScope = false;
}
var totalamtaftrdis = $scope.STBR.TotalAmountafterDiscount;
if (totalamtaftrdis == null || totalamtaftrdis == undefined || totalamtaftrdis == "" || totalamtaftrdis == 0) {
totalamtaftrdis = "0";
}
totalamtaftrdis = totalamtaftrdis.replace(/[^0-9\.]+/g,"");
if (parseInt(totalamtaftrdis) < 0) {
//alert("Total Amount should not be Less than or Equal to Zero");
$scope.STBR.alertTotalamount = "Total Amount should not be Less than Zero";
//$scope.isFormValid = false;
checkScope = false;
}
}
var Type = $scope.STBR.vchSTBType;
var stbno = $scope.STBR.stbserialnumber;
var url = baseurl + "/CableTransactions/checkSerialNumbers";// routerserialnumber: $scope.STBR.routerserialnumber, obj: $scope.STBR.vchRouterType, PackageTypeId: Type, Stbno: stbno
$http.post(url, { routerserialnumber: $scope.STBR.routerserialnumber, obj: $scope.STBR.vchRouterType, PackageTypeId: Type, Stbno: stbno }).success(function (data) {
;
if (data > 0) {
alert("Serial number Already Existed");
checkScope = false;
$scope.STBR.routerserialnumber = '';
}
else {
$scope.CalculateData();
$scope.submitted = true;
console.log($scope.subscriberSTBRdetails.$error.required);
if ($scope.isFormValid && checkScope) {
var ans = null;
var ans = confirm($rootScope.msgSave);
if (ans) {
;
var t1 = $scope.STBR.AdvanceAmount;
if (t1 == null || t1 == undefined || t1 == "" || t1 == 0) {
t1 = "0";
}
var t2 = $scope.STBR.DiscountAmount;
if (t2 == null || t2 == undefined || t2 == "" || t2 == 0) {
t2 = "0";
}
var t3 = $scope.STBR.InstallationCharges;
t3 += '';
if (t3 == null || t3 == undefined || t3 == "" || t3 == 0) {
t3 = "0";
}
var t4 = $scope.STBR.TotalAmount;
if (t4 == null || t4 == undefined || t4 == "" || t4 == 0) {
t4 = "0";
}
var t5 = $scope.STBR.TotalAmountafterDiscount;
if (t5 == null || t5 == undefined || t5 == "" || t5 == 0) {
t5 = "0";
}
var t6 = $scope.STBR.rtramount;
if (t6 == null || t6 == undefined || t6 == "" || t6 == 0) {
t6 = "0";
}
var t7 = $scope.STBR.stbamount;
if (t7 == null || t7 == undefined || t7 == "" || t7 == 0) {
t7 = "0";
}
$scope.STBR.AdvanceAmount = t1.replace(/[^0-9\.]+/g, "");
$scope.STBR.DiscountAmount = t2.replace(/[^0-9\.]+/g, "");
$scope.STBR.InstallationCharges = t3.replace(/[^0-9\.]+/g, "");
$scope.STBR.TotalAmount = t4.replace(/[^0-9\.]+/g, "");
$scope.STBR.TotalAmountafterDiscount = t5.replace(/[^0-9\.]+/g, "");
$scope.STBR.rtramount = t6.replace(/[^0-9\.]+/g, "");
$scope.STBR.stbamount = t7.replace(/[^0-9\.]+/g, "");
;
//var contype = $.grep($scope.lstconntype, function (c) {
// return c.ddlconnTypeid = $scope.STBR.ddlconnTypeid;
//})[0].ddlconnType;
//$scope.STBR.ddlconnType = contype;
var url = baseurl + "/CableTransactions/SaveSubscriberSTBRTRDetails";
$http.post(url, { jsonData: JSON.stringify($scope.STBR) }).success(function (data) {
;
alert(data.Message);
if (data.transstatus) {
$scope.ResetSubscriberSTBRTRDetails();
$scope.LoadSubscirberData();
$scope.GetGridData();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
$scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.GetSubscriberInformationAllDetails();
}
});
}
}
//else {
// alert("Please Fill all the Details");
//}
}
});
;
;
// $scope.CalculateData();
//$scope.submitted = true;
//if ($scope.isFormValid && checkScope)
//{
// var ans = null;
// var ans = confirm($rootScope.msgSave);
// if (ans) {
// $http.post('/CableTransactions/SaveSubscriberSTBRTRDetails', { objSubscriberSetupBoxRouterDetails: $scope.STBR }).success(function (data)
// {
// ;
// alert(data.Message);
// if (data.transstatus) {
// $scope.ResetSubscriberSTBRTRDetails();
// $scope.LoadSubscirberData();
// $scope.GetGridData();
// $scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// // $scope.GetSubscriberInformationAllDetails();
// }
// });
// }
//}
//else {
// alert("Please Fill all the Details");
//}
}
catch (e) {
alert(e.message);
}
}
$scope.ResetSubscriberSTBRTRDetails = function () {
;
try {
$scope.ClearSubscriberSTBRTRDetails();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
} catch (e) {
alert(e.message);
}
}
//****************** SAVING STB RTR DEATILS *******************************//
//****************** JQ Grid *******************************//
$scope.GetGridData = function () {
;
var url = baseurl + "/CableTransactions/GetSubscriberSTBRTRAllDetails";
$http({
url: url,
method: "get"
}).success(function (data) {
;
ShowSubscriberSTBRTRDetails(data);
//console.log(data);
});
}
function ShowSubscriberSTBRTRDetails(data) {
;
for (i = 0; i < data.length; i++) {
var Amount1 = data[i].rtramount;
var Amount2 = $scope.CurrencyFormat(Amount1);
data[i].rtramount = [];
data[i].rtramount = Amount2;
var Amount11 = data[i].stbamount;
var Amount22 = $scope.CurrencyFormat(Amount11);
data[i].stbamount = [];
data[i].stbamount = Amount22;
var Amount111 = data[i].Discountamount;
var Amount222 = $scope.CurrencyFormat(Amount111);
data[i].Discountamount = [];
data[i].Discountamount = Amount222;
var t1 = data[i].numtotalamount;
var t2 = $scope.CurrencyFormat(t1);
data[i].numtotalamount = [];
data[i].numtotalamount = t2;
var t11 = data[i].Advanceamount;
var t22 = $scope.CurrencyFormat(t11);
data[i].Advanceamount = [];
data[i].Advanceamount = t22;
var t12 = data[i].InstallationCharges;
var t21 = $scope.CurrencyFormat(t12);
data[i].InstallationCharges = [];
data[i].InstallationCharges = t21;
}
var grid_data = data;
var grid_selector = "#gridsubscriberSTBRTRdetails";
var pager_selector = "#grid-pager";
//grid data refresh
jQuery(grid_selector).jqGrid('setGridParam', { datatype: 'local', data: grid_data }).trigger("reloadGrid");
//resize to fit page size
$(window).on('resize.jqGrid', function () {
$(grid_selector).jqGrid('setGridWidth', $(".page-content").width());
})
//resize on sidebar collapse/expand
var parent_column = $(grid_selector).closest('[class*="col-"]');
$(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
//setTimeout is for webkit only to give time for DOM changes and then redraw!!!
setTimeout(function () {
$(grid_selector).jqGrid('setGridWidth', parent_column.width());
}, 0);
}
})
jQuery(grid_selector).jqGrid({
data: grid_data,
datatype: "local",
height: 290,
rownumbers: true,
colModel: [
{ label: 'Connection <br/><br/><br/><br/>ID', name: 'connectionid', width: 55, },
{ label: 'Subscriber <br/><br/><br/><br/>Name', name: 'suscribername', width: 80, },
{ label: 'Mobile <br/><br/><br/><br/>Number', name: 'mobilenumber', width: 65 },
{ label: 'Package <br/><br/><br/><br/>Type', name: 'packagetype', width: 45, },
{ label: 'Connection <br/><br/><br/><br/>Type', name: 'connectiontype', width: 55, },
{ label: 'Router <br/><br/><br/><br/>Sr No.', name: 'routerserialnumber', width: 40 },
{ label: 'Router <br/><br/><br/><br/>Amount', name: 'rtramount', width: 45, align: 'right' },
{ label: 'Router Warranty', name: 'rtrwarranty', width: 50, hidden: true },
{ label: 'STB <br/><br/><br/><br/>Sr No.', name: 'stbserialnumber', width: 50 },
{ label: 'STB <br/><br/><br/><br/>Amount', name: 'stbamount', width: 45, align: 'right' },
{ label: 'STB Warranty', name: 'stbwarranty', width: 50, hidden: true },
{ label: 'Installation <br/><br/><br/><br/>Charges', name: 'InstallationCharges', width: 60, align: 'right' },
{ label: 'Installed <br/><br/><br/><br/>By', name: 'employeename', width: 50, hidden: true },
{ label: 'Installation <br/><br/><br/><br/>Date', name: 'installationdate', width: 65, },
{ label: 'Discount <br/><br/><br/><br/>Amount', name: 'Discountamount', width: 50, align: 'right' },
{ label: 'Total <br/><br/><br/><br/>Amount', name: 'numtotalamount', width: 45, align: 'right', hidden: true },
{ label: 'Total <br/><br/><br/><br/>Amount ', name: 'numtotalamount', width: 45, align: 'right' },
{ label: 'STB Type', name: 'stbtype', width: 50, hidden: true },
{ label: 'Router Type', name: 'rtbtype', width: 50, hidden: true },
{ label: 'Advance Amount', name: 'Advanceamount', width: 50, hidden: true },
{
label: ' ', width: 55, sortable: false, key: true, formatter: function (cellvalue, options, rowObject) {
return "<button class='btn-grid' type='button' id='btnEdit' onclick='ViewRow(" + options.rowId + ");'><i class='fa fa-eye'></i><span style='color:#111;font-size:14px;font-weight:400'> View</span><br/></button> ";
}
}
],
viewrecords: true,
rowNum: 8,
rowList: [8, 16, 25, 100],
pager: pager_selector,
altRows: true,
search: true,
ignoreCase: true,
loadComplete: function (id) {
var table = this;
setTimeout(function () {
styleCheckbox(table);
updateActionIcons(table);
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
caption: "Subscriber Set Up Box and Router Details <span class='input-icon grid-search'> <input type='text' onkeyup='Search()' id='globalSearchText' placeholder='Search ...' class='nav-search-input' autocomplete='off'> <i class='ace-icon fa fa-search nav-search-icon'></i></span> "
});
$(window).triggerHandler('resize.jqGrid');
}
$scope.InstallaCharges = function (data) {
;
//var InstallCharg = $scope.STBR.InstallationCharges;
if (data == null || data == "" || data == 0 || data == undefined) {
$scope.STBR.InstallationCharges = 0;
}
//var InstallCharg = $scope.STBR.InstallationCharges;
//if(InstallCharg==0 || InstallCharg==null ||InstallCharg==undefined)
//{
// $scope.STBR.InstallationCharges = 0;
//}
}
$scope.Desposeamt = function () {
;
var desposeamtt = $scope.STBR.AdvanceAmount;
if (desposeamtt == 0 || desposeamtt == "" || desposeamtt == null || desposeamtt == undefined) {
$scope.STBR.AdvanceAmount = 0;
}
}
$scope.discountamt = function () {
;
var discountamtt = $scope.STBR.DiscountAmount;
if (discountamtt == 0 || discountamtt == "" || discountamtt == null || discountamtt == undefined) {
$scope.STBR.DiscountAmount = 0;
}
}
$scope.totalamt = function () {
;
var totalamtt = $scope.STBR.TotalAmount;
if (totalamtt == 0 || totalamtt == "" || totalamtt == null || totalamtt == undefined) {
$scope.STBR.TotalAmount = 0;
}
}
$scope.totalamtaftrdst = function () {
;
var totalamtaftrdstt = $scope.STBR.TotalAmountafterDiscount;
if (totalamtaftrdstt == 0 || totalamtaftrdstt == "" || totalamtaftrdstt == null || totalamtaftrdstt == undefined) {
$scope.STBR.TotalAmountafterDiscount = 0;
}
}
$scope.CurrencyFormat = function (nStr) {
;
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
var z = 0;
var len = String(x1).length;
var num = parseInt((len / 2) - 1);
while (rgx.test(x1)) {
if (z > 0) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
else {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
rgx = /(\d+)(\d{2})/;
}
z++;
num--;
if (num == 0) {
break;
}
}
return x1 + x2;
}
$scope.SetCurrency = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.InstallationCharges = $scope.CurrencyFormat(amount);
}
$scope.SetCurrencyDiscount = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.DiscountAmount = $scope.CurrencyFormat(amount);
}
$scope.SetCurrencyAdvance = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.AdvanceAmount = $scope.CurrencyFormat(amount);
}
//****************** JQ Grid *******************************//
});
@{
Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
<style>
.modal-dialog {
width: 75%;
}
.ui-jqgrid .ui-jqgrid-labels {
height: 43px !important;
}
</style>
<script src="@Url.Content("~/Scripts/MsoScripts/Transactions/SubscriberSTBRouterDetails.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap-switch.js")"></script>
<link href="~/Content/Css/bootstrap-switch.css" rel="stylesheet" />
<div ng-app="RMS" ng-controller="SubscriberSTBRouterCtrl" ng-init="DatepickerEnableStatus();LoadSubscirberData();GetPackagesDetails();GetData();GetGridData();">
<div class="page-content">
<div class="row">
<div class="col-xs-12 col-sm-12">
<form name="subscriberSTBRdetails" novalidate class="form-horizontal">
<div class="col-md-12">
<div>
<h5 class="widget-title red dark-10 no-padding " style="font-size:16px; font-weight:600; margin:5px 0px;">
<i class="ace-icon fa fa-user"></i>
SUBSCRIBER SET UP BOX AND ROUTER DETAILS
</h5>
<div class="form-group">
<label class=" col-sm-2 control-label FullWidth">
Date<span style="color: Red">*</span> :
</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="Date" ng-model="STBR.datdate" placeholder="Enter Date" data-date-format="dd/mm/yyyy"
class="form-control" id="Date" required ng-disabled="DateEnableStatus" />
<span class="error" ng-show="(subscriberSTBRdetails.Date.$dirty || submitted) && subscriberSTBRdetails.Date.$error.required">
Date Required
</span>
</div>
<label class=" col-sm-2 control-label FullWidth">
Subscriber Name<span style="color: Red">*</span> :
</label>
<div class="col-sm-6">
<ui-select name="productname" id="productname" required ng-model="SubscriberSTBRouterCtrl.v.selected.vchsubscribername" on-select=" Subscriber_Change(SubscriberSTBRouterCtrl.v.selected)" title="Select Subscriber Name" ng-disabled="isdisabled" width="400">
<ui-select-match placeholder="Select Subscriber Name">{{$select.selected.vchsubscribername}}</ui-select-match>
<ui-select-choices repeat="v in subscriber | propsFilter: {vchsubscribername: $select.search,vchregistrationid: $select.search,vchmobilenumber: $select.search}">
<div ng-bind-html="v.vchsubscribername | highlight: $select.search"></div>
<small>
Subscriber Id: <span ng-bind-html="v.vchregistrationid | highlight: $select.search" style="font-family: Verdana; font-weight: bold; color: #FF6E33"></span>
Mobile No.:<span ng-bind-html="v.vchmobilenumber | highlight: $select.search" style="font-family: Verdana; font-weight: bold; color: #FF6E33"></span>
</small>
</ui-select-choices>
</ui-select>
<span class="error" ng-show="(subscriberSTBRdetails.productname.$dirty || submitted) && subscriberSTBRdetails.productname.$error.required">
Subscriber Name Required
</span>
</div>
</div>
<div class='form-group'>
<label class=" col-sm-2 control-label FullWidth">Registration ID :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtRegistrationId" ng-model="STBR.registrationid" id="txtRegistrationId" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth" ng-show="false">Subscriber Name :</label>
<div class="col-sm-3 FullWidth" ng-show="false">
<input type="text" name="txtSuscriberName" ng-model="STBR.suscribername" id="txtSuscriberName" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Mobile No. :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtMobileNo" ng-model="STBR.mobilenumber" id="txtMobileNo" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Type Of Package<span style="color:red">*</span>:</label>
<div class="col-sm-2 FullWidth">
<select id="PackageType" class=" form-control" name="PackageTypeId" kt-focus data-index="1" ng-model="STBR.PackageTypeId" ng-change="SelectRouterDetails(STBR);GetconnType();" ng-options="c.PackageTypeId as c.PackageType for c in packagetypes" ng-required="true" ng-disabled="EditDisable">
<option value="">Select Package</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.PackageTypeId.$dirty || submitted ) && subscriberSTBRdetails.PackageTypeId.$error.required">
Package Required
</span>
</div>
</div>
<div class="form-group" ng-show="false">
<h3 class="scheduler-border blue" style="font-size:12px; font-weight:600; margin:5px 0px;">
EXISTING CONNECTIONS
</h3>
</div>
<div class='form-group' ng-show="false">
<label class=" col-sm-2 control-label FullWidth">STB SD Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingSTBSD" ng-model="STBR.existingSTBSD" id="txtExistingSTBSD" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">STB HD Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingSTBHD" ng-model="STBR.existingSTBHD" id="txtExistingSTBHD" disabled />
</div>
<label class=" col-sm-2 control-label FullWidth">Router Count :</label>
<div class="col-sm-2 FullWidth">
<input type="text" name="txtExistingRouter" ng-model="STBR.existingRouter" id="txtExistingRouter" disabled />
</div>
</div>
<div class='form-group'>
<label class=" col-sm-2 control-label FullWidth">Connection Type <span style="color:red">*</span>:</label>
<div class="col-sm-3 FullWidth">
<select id="FilterConnectionType" class=" form-control" name="FilterConnectionType" kt-focus data-index="1" ng-model="STBR.ddlconnType" ng-change="ConnectionType_Change()" ng-options="c.ddlconnType as c.ddlconnType for c in lstconntype" ng-required="true" ng-disabled="EditDisable">
<option value="">Select Connection Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.FilterConnectionType.$dirty || submitted) && subscriberSTBRdetails.FilterConnectionType.$error.required">
Connection Type Required
</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 no-padding">
<fieldset class="scheduler-border ">
<legend class="scheduler-border blue">
@*<div class="checkbox" ng-show="STBR.checkboxrouter" style="width:auto; float:left;">
<label>
<input type="checkbox" value="" ng-model="STBR.chkRouter" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
</label>
</div>*@
<input type="checkbox" ng-model="STBR.chkRouter" ng-show="STBR.checkboxrouter" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<h5 style="float: right; position: relative; margin: 3px 0px 0px 3px; "><i class="fa fa-assistive-listening-systems red"></i> ROUTER DETAILS</h5>
</legend>
<div>
<div class="form-group"></div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Type<span style="color:red">{{mandataryrt}}</span>:
</label>
<div class="col-sm-8">
<select name="RouterType" ng-model="STBR.vchRouterType" ng-options="c.vchRouterType as c.vchRouterType for c in lstroutertypes" class="form-control" data-index="1" ng-change="getRouterAmountDetails(STBR);" ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter">
<option value="">Select Router Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.RouterType.$dirty || submitted) && subscriberSTBRdetails.RouterType.$error.required">
Router Type Required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Serial No.<span style="color:red">{{mandataryrt}}</span>:
</label>
<div class="col-sm-8">
@*<select name="RouterSerialNumber" ng-model="STBR.routerserialnumber" ng-options="c.routerserialnumber as c.routerserialnumber for c in lstrouterserialnumbers" class="form-control" data-index="1" ng-disabled="!STBR.chkRouter" ng-required="!STBR.chkrouter">
<option value="">Select Router Serial Number</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.routerserialnumber.$dirty || submitted) && subscriberSTBRdetails.routerserialnumber.$error.required">
Router Serial No. Required
</span>*@
<input type="text" id="routerserialnumber" class="form-control" capitalize maxlength="50"
name="RouterSerialNumber" ng-model="STBR.routerserialnumber" placeholder="Enter Router Serial No." ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter" ng-blur="GetserialnumberROUTER(STBR.routerserialnumber,STBR.vchRouterType);" />
<span class="error" ng-show="(subscriberSTBRdetails.RouterSerialNumber.$dirty || submitted) && subscriberSTBRdetails.RouterSerialNumber.$error.required">
Router Serial No. required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Warranty(Months)<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="rtrwarranty" style="text-align:right" ng-model="STBR.rtrwarranty" placeholder="Enter Warranty(Months)" kit-digits maxlength="2"
class="form-control" id="rtrwarranty" ng-disabled="!STBR.chkRouter" ng-required="STBR.chkRouter" />
<span class="error" ng-show="(subscriberSTBRdetails.rtrwarranty.$dirty || submitted) && subscriberSTBRdetails.rtrwarranty.$error.required">
Router Warranty required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Router Amount<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="rtramount" ng-model="STBR.rtramount" style="text-align:right" placeholder="Enter Router Amount" disabled
class="form-control" id="rtramount" />
</div>
</div>
</div>
</fieldset>
</div>
<div class="col-sm-6 no-padding">
<fieldset class="scheduler-border ">
<legend class="scheduler-border blue">
@*<div class="checkbox" ng-show="STBR.checkboxsetupbox" style="width:auto; float:left;">
<label>
<input type="checkbox" value="" ng-model="STBR.chkSTB" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
</label>
</div>*@
<input type="checkbox" ng-model="STBR.chkSTB" ng-show="STBR.checkboxsetupbox" ng-change="getSTBRTRSerialNumbersMMS(STBR);">
<h5 style="float: right; position: relative; margin: 3px 0px 0px 3px; "><i class="fa fa-assistive-listening-systems red"></i>SETUP BOX DETAILS</h5>
</legend>
<div>
<div class="form-group"></div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Type<span style="color:red">{{mandatarystb}}</span>:
</label>
<div class="col-sm-8">
<select name="STBType" ng-model="STBR.vchSTBType" ng-options="c.vchSTBType as c.vchSTBType for c in lststbtypes" class="form-control" data-index="1" ng-change="getSTBAmountDetails(STBR);" ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB">
<option value="">Select STB Type</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.STBType.$dirty || submitted) && subscriberSTBRdetails.STBType.$error.required">
STB Type Required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Serial No.<span style="color:red">{{mandatarystb}}</span>:
</label>
<div class="col-sm-8">
@*<select name="STBSerialNumber" ng-model="STBR.stbserialnumber" ng-options="c.stbserialnumber as c.stbserialnumber for c in lststbserialnumbers" class="form-control" data-index="1" ng-disabled="!STBR.chkSTB" ng-required="!STBR.chkSTB">
<option value="">Select STB Serial Number</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.stbserialnumber.$dirty || submitted) && subscriberSTBRdetails.stbserialnumber.$error.required">
STB Serial No. Required
</span>*@
<input type="text" id="stbserialnumber" class="form-control" capitalize maxlength="50"
name="STBSerialNumber" ng-model="STBR.stbserialnumber" placeholder="Enter STB Serial No." ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB" ng-blur="Getserialnumber(STBR.stbserialnumber,STBR.vchSTBType);" />
<span class="error" ng-show="(subscriberSTBRdetails.STBSerialNumber.$dirty || submitted) && subscriberSTBRdetails.STBSerialNumber.$error.required">
STB Serial No. required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Warranty(Months)<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="stbwarranty" ng-model="STBR.stbwarranty" style="text-align:right" placeholder="Enter STB Warranty(Months)" ng-disabled="!STBR.chkSTB" ng-required="STBR.chkSTB"
class="form-control" id="stbwarranty" kit-digits maxlength="2" />
<span class="error" ng-show="(subscriberSTBRdetails.stbwarranty.$dirty || submitted) && subscriberSTBRdetails.stbwarranty.$error.required">
STB Warranty required
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
STB Amount<span style="color: Red"></span>:
</label>
<div class="col-sm-8">
<input type="text" name="stbamount" ng-model="STBR.stbamount" style="text-align:right" placeholder="Enter STB Amount" disabled
class="form-control" id="stbamount" />
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installation Charges :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Installation Charges" style="text-align:right;" ng-blur="InstallaCharges(STBR.InstallationCharges);CalculateData()" name="InstallationCharges" ng-model="STBR.InstallationCharges" valid-numberr maxlength="10" ng-change="CalculateData();SetCurrency(STBR.InstallationCharges);"
ng-keydown="CalculateData();" ng-mouseleave="CalculateData();" ng-click="CalculateData();" ng-keypress="CalculateData();" ng-keyup="CalculateData();SetCurrency(STBR.InstallationCharges);" />
@*<span class="error" ng-show="(subscriberSTBRdetails.InstallationCharges.$dirty || submitted) && subscriberSTBRdetails.InstallationCharges.$error.required">
Installation Charges Required
</span>*@
</div>
</div>
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installation Date <span style="color: Red">*</span>:</label>
<div class="col-sm-7 FullWidth">
<input type="text" name="InstallationDate" id="InstallationDate" readonly ng-model="STBR.installationdate" placeholder="Enter Date" data-date-format="dd/mm/yyyy"
class="form-control" required ng-change="getInstallationDate(STBR);" />
<span class="error" ng-show="(subscriberSTBRdetails.InstallationDate.$dirty || submitted) && subscriberSTBRdetails.InstallationDate.$error.required">
Date Required
</span>
</div>
</div>
<div class="col-sm-4">
<label class=" col-sm-5 control-label FullWidth">Installed By <span style="color: Red">*</span>:</label>
<div class="col-sm-7 FullWidth">
<select name="EmpName" ng-model="STBR.EmployeeName" ng-options="c.EmployeeName as c.EmployeeName for c in lstemployeename" class="form-control" data-index="1" required>
<option value="">Select Name</option>
</select>
<span class="error" ng-show="(subscriberSTBRdetails.EmpName.$dirty || submitted) && subscriberSTBRdetails.EmpName.$error.required">
Installed By Required
</span>
</div>
</div>
</div>
<div class='form-group'>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Deposit Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" ng-blur="Desposeamt();" placeholder="Enter Deposit Amount" ng-change="SetCurrencyAdvance(STBR.AdvanceAmount);" style="text-align:right;" name="AdvanceAmount" ng-model="STBR.AdvanceAmount" valid-numberr maxlength="10" />
</div>
</div>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Total Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" ng-blur="totalamt();" placeholder="Enter Total Amount" style="text-align:right;" name="TotalAmount" ng-model="STBR.TotalAmount" kit-amount disabled />
</div>
</div>
</div>
<div class='form-group'>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Discount Amount :</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Discount Amount" ng-blur="discountamt();CalculateData();" style="text-align:right;" name="DiscountAmount" ng-model="STBR.DiscountAmount" valid-numberr maxlength="10" ng-change="CalculateData();SetCurrencyDiscount(STBR.DiscountAmount);" ng-keydown="CalculateData();" ng-mouseleave="CalculateData();" ng-click="CalculateData();" ng-keypress="CalculateData();" ng-keyup="CalculateData();" />
<span class="error">{{STBR.alertamount}}</span>
@*<span class="error" ng-show="(subscriberSTBRdetails.DiscountAmount.$dirty || submitted) && subscriberSTBRdetails.DiscountAmount.$error.required">
Discount Name Required
</span>*@
</div>
</div>
<div class="col-sm-4 ">
<label class=" col-sm-5 control-label FullWidth">Total Amount after Discount:</label>
<div class="col-sm-7 FullWidth">
<input type="text" class="form-control" placeholder="Enter Total Amount" ng-blur="totalamtaftrdst();" style="text-align:right;" name="TotalAmountafterDiscount" ng-model="STBR.TotalAmountafterDiscount" valid-numberr disabled />
<span class="error">{{STBR.alertTotalamount}}</span>
</div>
</div>
</div>
<div class='form-group'>
<div class="pull-right">
<button class="btn btn-success" data-index="3" type="button" ng-click="SaveSTBRTRDetails()">
<i class="ace-icon fa fa-plus bigger-110"></i>Save
</button>
<button class=" btn btn-danger" ng-click="ResetSubscriberSTBRTRDetails()">
<i class="fa fa-times"></i>Reset
</button>
</div>
</div>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #5499C7;">
<button type="button" ng-click="BoostClear()" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" style="align-content:center" id="myModalLabel">Subscriber STB & Router Details</h4>
</div>
<div class="modal-body">
<div class="form-group">
<span class="col-sm-4 control-labe">Connection ID : <span style="color:red">{{connectionid}}</span></span>
<span class="col-sm-4 control-labe">Subscriber Name : <span style="color:red">{{subscribername}}</span></span>
<span class="col-sm-4 control-labe">Mobile No. : <span style="color:red">{{mobilenumber}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Package Type : <span style="color:red">{{packagetype}}</span></span>
@*<span class="col-sm-3 control-labe">Package Type:<span style="color:red">{{packagetype}}</span></span>*@
<span class="col-sm-4 control-labe">Connection Type : <span style="color:red">{{connectiontype}}</span></span>
<span class="col-sm-4 control-labe" ng-show="invisiblerouter">Router Type : <span style="color:red">{{routertype}}</span></span>
</div>
<div class="form-group" ng-show="invisiblerouter">
<span class="col-sm-4 control-labe">Router No. : <span style="color:red">{{routernumber}}</span></span>
<span class="col-sm-4 control-labe">Router Warranty : <span style="color:red">{{routerwarranty}}</span></span>
<span class="col-sm-4 control-labe">Router Amount : <span style="color:red">{{routeramount}}</span></span>
</div>
<div class="form-group" ng-show="invisiblestb">
<span class="col-sm-4 control-labe">STB Type : <span style="color:red">{{stbtype}}</span></span>
<span class="col-sm-4 control-labe">STB No. : <span style="color:red">{{stbnumber}}</span></span>
<span class="col-sm-4 control-labe">STB Warranty(In Months) : <span style="color:red">{{stbwarranty}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe" ng-show="invisiblestb">STB Amount : <span style="color:red">{{stbamount}}</span></span>
<span class="col-sm-4 control-labe">Installation Charges : <span style="color:red">{{installationcharges}}</span></span>
<span class="col-sm-4 control-labe">Installed By : <span style="color:red">{{installedby}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Installation Date : <span style="color:red">{{Installationdate}}</span></span>
<span class="col-sm-4 control-labe">Discount Amount : <span style="color:red">{{discountamount}}</span></span>
<span class="col-sm-4 control-labe">Total Amount : <span style="color:red">{{tatalamount}}</span></span>
</div>
<div class="form-group">
<span class="col-sm-4 control-labe">Deposit Amount : <span style="color:red">{{advanceamount}}</span></span>
<span class="col-sm-4 control-labe" ng-show="false">Total Amount After Discount : <span style="color:red">{{totalamountafterdiscount}}</span></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="clearfix"></div>
<table id="gridsubscriberSTBRTRdetails"></table>
<div id="grid-pager">
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//SubscriberSTBRouterCtrl as
var appElement = document.querySelector('[ng-controller=SubscriberSTBRouterCtrl]');
function Search() {
;
JqCustomSearch($("#globalSearchText").val(), $("#gridsubscriberSTBRTRdetails"))
}
function ViewRow(row) {
;
//var $http = angular.element(appElement).injector().get('$http');
//var $scope = angular.element(appElement).scope();
var appElement = document.querySelector('[ng-controller=SubscriberSTBRouterCtrl]');
var $http = angular.element(appElement).injector().get('$http');
var $scope = angular.element(appElement).scope();
var rowdata = jQuery("#gridsubscriberSTBRTRdetails").jqGrid('getRowData', row);
//var copy = Object.assign({}, rowdata);
// $scope.ADON = copy;
$scope.GetGridData();
if (rowdata.packagetype == "ISP") {
$scope.invisiblestb = false;
$scope.invisiblerouter = true;
}
else if (rowdata.packagetype == "CABLE") {
$scope.invisiblestb = true;
$scope.invisiblerouter = false;
}
else {
$scope.invisiblestb = true;
$scope.invisiblerouter = true;
}
;
//$scope.connectionid = $scope.connectionid;
$scope.connectionid = rowdata.connectionid;
//$scope.packagetype = $scope.ADON.PackageType;
$scope.subscribername = rowdata.suscribername;
$scope.mobilenumber = rowdata.mobilenumber;
$scope.packagetype = rowdata.packagetype;
$scope.connectiontype = rowdata.connectiontype;
$scope.routertype = rowdata.rtbtype;
$scope.routernumber = rowdata.routerserialnumber;
$scope.routerwarranty = rowdata.rtrwarranty;
$scope.routeramount = rowdata.rtramount;
$scope.stbtype = rowdata.stbtype;
$scope.stbnumber = rowdata.stbserialnumber;
$scope.stbwarranty = rowdata.stbwarranty;
$scope.stbamount = rowdata.stbamount
//$scope.packagetype = $scope.ADON.PackageType;
$scope.installationcharges = rowdata.InstallationCharges;
$scope.installedby = rowdata.employeename;
$scope.Installationdate = rowdata.installationdate;
$scope.advanceamount = rowdata.Advanceamount;
$scope.discountamount = rowdata.Discountamount;
$scope.tatalamount = rowdata.numtotalamount;
$scope.totalamountafterdiscount = rowdata.numtotalamount;
$('#myModal1').modal('show');
$scope.$apply();
//$http.post('/CableMastres/CheckBoostupEditName/', rowdata).success(function (data) {
// ;
// if (data == 1) {
// ;
// //$scope.BoostupbtnSave = "Update";
// //$scope.SetAddonPackageNames(copy);
// //$scope.setfixedorpaisa(copy);
// //$scope.EditDisable = true;
// //$scope.GetPackagesTypes($scope.PG);
// //$scope.GetPackageNames();
// //$scope.GetAmountDurationOnEdit(copy);
// //$scope.GetaAmount(copy);
// //$scope.$apply();
// //$scope.fixedpaisa_change();
// // init();
// }
// else {
// alert("Cannot Update Package as it is in use by the application");
// }
//})
}
app.directive('validNumberr', function () {
return {
require: '?ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
if (!ngModelCtrl) {
return;
}
ngModelCtrl.$parsers.push(function (val) {
if (angular.isUndefined(val)) {
var val = '';
}
var clean = val.replace(/[^0-9\.,]/g, '');
var decimalCheck = clean.split('.');
if (!angular.isUndefined(decimalCheck[1])) {
decimalCheck[1] = decimalCheck[1].slice(0, 2);
clean = decimalCheck[0] + '.' + decimalCheck[1];
}
if (val !== clean) {
ngModelCtrl.$setViewValue(clean);
ngModelCtrl.$render();
}
return clean;
});
element.bind('keypress', function (event) {
if (event.keyCode === 32) {
event.preventDefault();
}
});
}
};
});
</script>
<script type="text/javascript">
$(function () {
//$('.Search-Select').searchable();
$("#Date").datepicker();
// $('#Date').datepicker('setEndDate', 'today');
$("#InstallationDate").datepicker();
//$("#InstallationDate").datepicker("setDate", 'today');
// $('#installationdate').datepicker('setEndDate', 'today');
});
</script>
<style>
.ui-datepicker-calendar, .ui-datepicker-year {
display: none;
}
.modal-dialog {
width: 75%;
}
.ui-jqgrid .ui-jqgrid-htable th div {
height: 43px;
overflow: hidden;
padding-top: 11px;
position: relative;
vertical-align: text-top;
white-space: normal !important;
}
.ui-state-default.ui-jqgrid-hdiv {
height: 44px;
}
.ui-jqgrid tr.jqgrow td {
white-space: normal !important;
/*height: auto;
padding-top: 3px;
vertical-align: text-top;*/
}
</style>
-- js file
var app = angular.module('RMS');
app.controller('SubscriberSTBRouterCtrl', function ($scope, $http, $rootScope, $filter) {
;
$rootScope.FormName = "Subscriber Set Up Box And Router Details";
$rootScope.ModuleName = "MSO Transactions";
var pim = this;
$scope.STBR = {};
$scope.submitted = false;
$scope.isFormValid = false;
//$scope.disableInstaDate = true;
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
$scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.lstConnectionTypes = [{ ConnectionTypeId: "1", FilterConnectionType: "PREPAID" }, { ConnectionTypeId: "2", FilterConnectionType: "POSTPAID" }];
$scope.STBR.chkRouter = false;
$scope.STBR.chkSTB = false;
var res = window.location.pathname.split("/");
var baseurl = window.location.protocol + "//" + window.location.host;
if (res.length > 3) {
for (i = 1; i < res.length - 2; i++)
baseurl = baseurl + "/" + res[i];
}
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = false;
$scope.GetGridData = [];
$scope.Getpvdate = function () {
;
var url = baseurl + "/CableTransactions/GetDate";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.billdate = data;
});
}
//var url = baseurl + "/CableTransactions/GetConnType";
//$http({
// url: url,
// method: "post"
//}).success(function (data) {
// ;
// // $scope.lstConnectionTypes = data;
//});
$scope.GetconnType = function () {
;
var url = baseurl + "/MSOReports/getConnType";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.lstconntype = data;
});
}
$scope.Getserialnumber = function (number, type) {
;
// var type; //= $scope.STBR.vchconnectiontype;
//type= $scope.STBR.vchSTBType;
var type = $scope.STBR.vchRouterType;
// if (($scope.STBR.stbserialnumber != undefined && $scope.STBR.routerserialnumber != undefined) && ($scope.STBR.stbserialnumber != "" && $scope.STBR.routerserialnumber != "")) {
if (($scope.STBR.stbserialnumber != undefined) && ($scope.STBR.stbserialnumber != "")) {
if ($scope.STBR.stbserialnumber == $scope.STBR.routerserialnumber) {
alert("Router And STB Serial Numbers Should Not be Same");
$scope.STBR.stbserialnumber = "";
}
else {
var count = 0;
var url = baseurl + "/CableTransactions/checkSerialNumbers";
$http.post(url, { type: type, number: number }).success(function (data) {
;
//count = Convert.ToInt(data);
if (data.Count > 0) {
alert(data.Message);
checkScope = false;
$scope.STBR.stbserialnumber = '';
}
else {
checkScope = true;
}
});
}
}
}
$scope.GetserialnumberROUTER = function (number, type) {
;
// var type; //= $scope.STBR.vchconnectiontype;
//type= $scope.STBR.vchSTBType;
var type = $scope.STBR.vchRouterType;
//if (($scope.STBR.stbserialnumber != undefined && $scope.STBR.routerserialnumber != undefined) && ($scope.STBR.stbserialnumber != "" && $scope.STBR.routerserialnumber != "")) {
if (($scope.STBR.routerserialnumber != undefined) && ($scope.STBR.routerserialnumber != "")) {
if ($scope.STBR.stbserialnumber == $scope.STBR.routerserialnumber) {
alert("Router And STB Serial Numbers Should Not be Same");
$scope.STBR.routerserialnumber = "";
}
else {
var count = 0;
var url = baseurl + "/CableTransactions/checkSerialNumbers";
$http.post(url, { type: type, number: number }).success(function (data) {
;
//count = Convert.ToInt(data);
if (data.Count > 0) {
alert(data.Message);
checkScope = false;
$scope.STBR.routerserialnumber = '';
}
else {
checkScope = true;
}
});
}
}
}
function GetSelectedDate(date) {
;
try {
if (date != "" && date != null && date != "Invalid Date")
return date.getDate() + '-' + (parseInt(date.getMonth()) + 1) + '-' + date.getFullYear();
else
return null;
} catch (e) {
alert(e.message);
}
}
function GetFormatedDate(date) {
;
try {
if (date != "" && date != null && date != "Invalid Date") {
if (date.search("/") > 0)
var parts = date.split("/");
else if (date.search("-") > 0)
var parts = date.split("-");
return new Date(parts[2], parts[1] - 1, parts[0]);
}
else
return null;
} catch (e) {
alert(e.message);
}
}
$scope.ConnectionType_Change = function () {
$scope.STBR.installationdate = null;
if ($scope.STBR.ddlconnTypeid == "1") {
$scope.Getpvdate();
}
}
$scope.getInstallationDate = function () {
;
var InstallationDate = GetFormatedDate($scope.STBR.installationdate);
var BillGenerationDate = GetFormatedDate($scope.billdate);
//$(function () {
// ;
// //alert("1");
// $("#InstallationDate").datepicker("minDate", BillGenerationDate);
// $("#InstallationDate").datepicker("maxDate", InstallationDate);
//});
if ($scope.STBR.ddlconnTypeid == "1") {
if (InstallationDate != null && BillGenerationDate != null) {
if (InstallationDate < BillGenerationDate) {
;
alert("Installation Date Should be Greate Than or Equal to " + GetSelectedDate(BillGenerationDate));
$scope.STBR.installationdate = null;
$scope.STBR.installationdate = [];
}
}
}
}
$scope.ClearSubscriberSTBRTRDetails = function () {
;
try {
;
$scope.STBR = {};
$scope.subscriberSTBRdetails.$setPristine();
pim.v = {};
$scope.submitted = false;
$scope.isFormValid = false;
$scope.CalculateData();
$scope.DatepickerEnableStatus();
location.reload();
} catch (e) {
alert(e.message);
}
}
$scope.ClearSubscriberSTBRTRDetails1 = function () {
;
try {
;
$scope.STBR = {};
$scope.lstconntype = [];
$scope.subscriberSTBRdetails.$setPristine();
$scope.submitted = false;
$scope.isFormValid = false;
$scope.CalculateData();
$scope.STBR.DiscountAmount = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.InstallationCharges = 0;
$scope.STBR.rtramount = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.TotalAmount = 0;
$scope.STBR.TotalAmountafterDiscount = 0;
} catch (e) {
alert(e.message);
}
}
$scope.$watch('subscriberSTBRdetails.$valid', function (newValue) {
$scope.isFormValid = newValue;
});
$scope.GetData = function () {
var url = baseurl + "/CableTransactions/GetData";
$http({ url: url, method: 'Get' }).success(function (data) {
;
if (data.length != 0) {
$scope.lstAllData = data;
}
});
}
//****************** DATE PICKER ENABLE AND DISABLE STATUS *******************************//
$scope.DatepickerEnableStatus = function () {
;
var url = baseurl + "/Login/GetDatepickerEnableStatus";
$http({
url: url,
method: "get"
}).success(function (data) {
;
if (data.Status != null) {
if (data.Status === "Y") {
$scope.DateEnableStatus = false;
} else {
$scope.DateEnableStatus = true;
}
}
else {
$scope.DateEnableStatus = true;
}
if (data.ServerDate != null) {
;
$scope.STBR.datdate = data.ServerDate;
$scope.STBR.installationdate = data.ServerDate;
var date1 = $scope.STBR.datdate;
$(function () {
;
//alert("1");
$("#Date").datepicker("setEndDate", date1);
$("#InstallationDate").datepicker("setEndDate", date1);
});
}
});
}
//****************** DATE PICKER ENABLE AND DISABLE STATUS *******************************//
//****************** GET PACKAGE TYPES *******************************//
$scope.GetPackagesDetails = function () {
var url = baseurl + "/CableMastres/GetPackageTypes";
$http({ url: url, method: 'Get' }).success(function (data) {
;
if (data.length != 0) {
$scope.packagetypes = data;
}
});
}
//****************** GET PACKAGE TYPES *******************************//
//****************** BIDING SUBSCRIBER NAMES AND RESPECTIVE TEXT BOXES ON THE SUBSCRIBER CHANGE *******************************//
$scope.LoadSubscirberData = function () {
;
$scope.STBR.DiscountAmount = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.InstallationCharges = 0;
$scope.STBR.rtramount = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.TotalAmount = 0;
$scope.STBR.TotalAmountafterDiscount = 0;
var url = baseurl + "/CableTransactions/GetSubscriberIdName";
$http({
url: url,
method: "get"
}).success(function (data) {
;
$scope.subscriber = data;
//console.log(data);
});
var url1 = baseurl + "/Login/ShowEmployeeName";
$http.get(url1).success(function (data) {
;
$scope.lstemployeename = eval('(' + data.Data + ')');
});
}
$scope.Subscriber_Change = function (subschaged) {
;
var found = false;
$scope.ClearSubscriberSTBRTRDetails1();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
var val = subschaged.vchsubscribername.vchregistrationid;
angular.forEach($scope.subscriber, function (tag) {
if (val.indexOf(tag.vchregistrationid) != -1) {
;
$scope.STBR.registrationid = subschaged.vchsubscribername.vchregistrationid;
$scope.STBR.suscribername = subschaged.vchsubscribername.vchsubscribername;
$scope.STBR.mobilenumber = subschaged.vchsubscribername.vchmobilenumber;
$scope.STBR.existingSTBSD = subschaged.vchsubscribername.ExistingSDSTB;
$scope.STBR.existingSTBHD = subschaged.vchsubscribername.ExistingHDSTB;
$scope.STBR.existingRouter = subschaged.vchsubscribername.ExitsingRouter;
}
});
return found;
}
//****************** BIDING SUBSCRIBER NAMES AND RESPECTIVE TEXT BOXES ON THE SUBSCRIBER CHANGE *******************************//
//****************** BINDING STB AND ROUTER NUMBERS AND THEIR AMOUNTS FROM MSO *******************************//
$scope.SelectRouterDetails = function () {
;
$scope.lstconntype = [];
$scope.STBR.InstallationCharges = 0;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.DiscountAmount = 0;
$scope.STBR.chkSTB = false;
$scope.STBR.stbtype = null;
$scope.STBR.stbserialnumber = null;
$scope.STBR.stbwarranty = 0;
$scope.STBR.stbamount = 0;
$scope.STBR.chkRouter = false;
$scope.STBR.routerserialnumber = null;
$scope.STBR.rtrwarranty = 0;
$scope.STBR.rtramount = 0;
$scope.lststbtypes = {};
$scope.lstroutertypes = {};
if ($scope.STBR.PackageTypeId == "1") {
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = true;
}
else if ($scope.STBR.PackageTypeId == "2") {
$scope.STBR.checkboxrouter = true;
$scope.STBR.checkboxsetupbox = false;
}
else if ($scope.STBR.PackageTypeId == "3") {
$scope.STBR.checkboxrouter = true;
$scope.STBR.checkboxsetupbox = true;
}
else {
$scope.STBR.checkboxrouter = false;
$scope.STBR.checkboxsetupbox = false;
}
$scope.CalculateData();
}
//****************** BINDING STB AND ROUTER NUMBERS AND THEIR AMOUNTS FROM MSO *******************************//
//****************** BINDING STB AND ROUTER SERIAL NUMBERS AND THEIR WARRANTY FROM MMS *******************************//
$scope.getSTBRTRSerialNumbersMMS = function () {
;
//$scope.STBR.stbamount = null;
//$scope.STBR.rtramount = null;
$scope.STBR.AdvanceAmount = 0;
$scope.STBR.DiscountAmount = 0;
// $scope.STBR.InstallationCharges = null;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if ($scope.STBR.chkRouter == true) {
// $scope.STBR.rtrwarranty = null;
$scope.mandataryrt = "*";
;
if ($scope.lstAllData != null || $scope.lstAllData !== undefined) {
;
$scope.lstroutertypes = {};
var lsttypes = [];
for (var i = 0; i < $scope.lstAllData.length; i++) {
if ($scope.lstAllData[i].vchpackagename === pkgType && $scope.lstAllData[i].vchcombodata === 'ISP') {
var routerTypes = { vchRouterType: $scope.lstAllData[i].vchRouterType };
lsttypes.push(routerTypes);
}
}
$scope.lstroutertypes = lsttypes;
}
var url = baseurl + "/CableTransactions/getSTBRTRDetailsfromMMS";
$http.post(url, { PackageTypeId: $scope.STBR.PackageTypeId }).success(function (data) {
;
$scope.lststbserialnumbers = data;
});
}
else {
$scope.mandataryrt = "";
$scope.STBR.rtramount = 0;
// $scope.STBR.InstallationCharges = null;
$scope.STBR.routerserialnumber = null;
$scope.STBR.rtrwarranty = 0;
$scope.STBR.vchRouterType = '';
if ($scope.stbamtA2 == undefined && $scope.stbamtA1 == undefined)
{
$scope.stbamtA2 = 0;
$scope.stbamtA1 = 0;
}
if ($scope.stbamtA2 == 0 && $scope.stbamtA1 == 0) {
$scope.STBR.InstallationCharges = 0;
}
else if ($scope.stbamtA2 == 0 && $scope.stbamtA1 != 0) {
// $scope.stbamt -= $scope.stbamtA1;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA2);
$scope.stbamtA1 = 0;
}
else {
$scope.stbamt -= $scope.stbamtA1;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
$scope.stbamtA1 = 0;
}
}
if ($scope.STBR.chkSTB == true) {
// $scope.STBR.stbwarranty = null;
$scope.mandatarystb = "*";
;
if ($scope.lstAllData != null || $scope.lstAllData !== undefined) {
;
$scope.lststbtypes = {};
var lsttypes = [];
//var pro = $scope.lstAllData.map(function (obj) { return obj.vchSTBType; });
//$scope.lststbtypes = pro.filter(function (v, i) { return pro.indexOf(v) == i; });
for (var i = 0; i < $scope.lstAllData.length; i++) {
if ($scope.lstAllData[i].vchpackagename === pkgType && $scope.lstAllData[i].vchcombodata === 'CABLE') {
var stbTypes = { vchSTBType: $scope.lstAllData[i].vchSTBType };
lsttypes.push(stbTypes);
}
}
$scope.lststbtypes = lsttypes;
}
var url = baseurl + "/CableTransactions/getSTBRTRDetailsfromMMS";
$http.post(url, { PackageTypeId: $scope.STBR.PackageTypeId }).success(function (data) {
;
$scope.lststbserialnumbers = data;
});
}
else {
$scope.mandatarystb = "";
$scope.STBR.stbserialnumber = null;
$scope.STBR.stbwarranty = 0;
$scope.STBR.stbamount = 0;
// $scope.STBR.InstallationCharges = null;
$scope.STBR.vchSTBType = '';
if ($scope.stbamtA2 == undefined && $scope.stbamtA1 == undefined) {
$scope.stbamtA2 = 0;
$scope.stbamtA1 = 0;
}
if ($scope.stbamtA2 == 0 && $scope.stbamtA1 == 0) {
$scope.STBR.InstallationCharges = 0;
}
else if ($scope.stbamtA2 != 0 && $scope.stbamtA1 == 0) {
//$scope.stbamt -= $scope.stbamtA2;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA1);
$scope.stbamtA2 = 0;
}
else {
$scope.stbamt -= $scope.stbamtA2;
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
$scope.stbamtA2 = 0;
}
}
$scope.CalculateData();
}
$scope.getRouterAmountDetails = function () {
;
var RouterType = $scope.STBR.vchRouterType;
$scope.stbamtA1 = 0;
$scope.stbamtA2;
$scope.stbamt = 0;
// $scope.stbamtA1 = $scope.STBR.InstallationCharges;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if (($scope.lstAllData != null || $scope.lstAllData !== undefined) && ($scope.lststbtypes != null || $scope.lststbtypes !== undefined)) {
;
var count = 0;
for (var i = 0; i < $scope.lstAllData.length; i++) {
;
if (($scope.lstAllData[i].vchpackagename === pkgType) && ($scope.lstAllData[i].vchRouterType === RouterType)) {
var rtamount = $scope.lstAllData[i].numAmount;
$scope.STBR.rtramount = $scope.CurrencyFormat(rtamount);
$scope.stbamtA1 = $scope.lstAllData[i].InstallationCharges;
count = 1;
if ($scope.stbamtA2 == null && $scope.stbamtA2 == undefined) {
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA1);
}
else {
$scope.stbamt = parseFloat($scope.stbamtA1) + parseFloat($scope.stbamtA2);
$scope.STBR.InstallationCharges = $scope.stbamt;
}
}
}
if (count == 0) {
$scope.STBR.rtramount = null;
// $scope.STBR.InstallationCharges = null;
}
}
$scope.CalculateData();
}
$scope.getSTBAmountDetails = function () {
;
var STBType = $scope.STBR.vchSTBType;
$scope.stbamtA2 = 0;
$scope.stbamtA1;
$scope.stbamt = 0;
// $scope.InstalSumAmt = $scope.STBR.InstallationCharges;
var pkgType = $.grep($scope.packagetypes, function (c) {
return c.PackageTypeId == $scope.STBR.PackageTypeId;
})[0].PackageType;
if (($scope.lstAllData != null || $scope.lstAllData !== undefined) && ($scope.lststbtypes != null || $scope.lststbtypes !== undefined)) {
;
var count = 0;
for (var i = 0; i < $scope.lstAllData.length; i++) {
;
if (($scope.lstAllData[i].vchpackagename === pkgType) && ($scope.lstAllData[i].vchSTBType === STBType)) {
var numstbamt = $scope.lstAllData[i].numAmount;
$scope.STBR.stbamount = $scope.CurrencyFormat(numstbamt);
$scope.stbamtA2 = $scope.lstAllData[i].InstallationCharges;
count = 1;
if ($scope.stbamtA1 == null && $scope.stbamtA1 == undefined) {
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamtA2);
}
else {
$scope.stbamt = parseFloat($scope.stbamtA2) + parseFloat($scope.stbamtA1);
$scope.STBR.InstallationCharges = $scope.CurrencyFormat($scope.stbamt);
}
}
}
if (count == 0) {
$scope.STBR.stbamount = null;
// $scope.STBR.InstallationCharges = null;
}
//else {
// $scope.InstalSumAmt = $scope.stbamt + $scope.rtamt;
//}
}
$scope.CalculateData();
}
//****************** BINDING STB AND ROUTER SERIAL NUMBERS AND THEIR WARRANTY FROM MMS *******************************//
//****************** FUNCTION FOR CALCULATING TOTALS *******************************//
$scope.CalculateData = function () {
var stbamout = $scope.STBR.stbamount;
var routeramount = $scope.STBR.rtramount;
var Instalamt = $scope.STBR.InstallationCharges;
Instalamt = String(Instalamt);
// alert(Instalamt);
var DiscountAmt = $scope.STBR.DiscountAmount;
var TotAmtafterDiscount = $scope.STBR.TotalAmountafterDiscount
if (stbamout == null || stbamout == undefined || stbamout == 'empty' || stbamout == "" || stbamout==0) {
stbamout = "0";
}
stbamout = stbamout.replace(/[^0-9\.]+/g,"");
if (routeramount == null || routeramount == undefined || routeramount == 'empty' || routeramount == "" || routeramount==0) {
routeramount ="0";
}
routeramount = routeramount.replace(/[^0-9\.]+/g, "");
if (Instalamt == null || Instalamt == undefined || Instalamt == 'empty' || Instalamt == "" || Instalamt==0) {
Instalamt ="0";
}
Instalamt = Instalamt.replace(/[^0-9\.]+/g, "");
if (DiscountAmt == null || DiscountAmt == undefined || DiscountAmt == 'empty' || DiscountAmt == "" || DiscountAmt==0) {
DiscountAmt = "0";
}
DiscountAmt = DiscountAmt.replace(/[^0-9\.]+/g, "");
var totalamt1 = $scope.STBR.TotalAmount;
if (totalamt1 == null || totalamt1 == undefined || totalamt1 == 'empty' || totalamt1 == "" || totalamt1 == 0) {
totalamt1 = "0";
}
var totalamt = totalamt1.replace(/[^0-9\.]+/g, "");
if (parseInt(DiscountAmt) > 0 || parseInt(totalamt) > 0) {
if (parseInt(DiscountAmt) > parseInt(totalamt)) {
//alert("Discount should not be Greater than or Equal to Total Amount");
$scope.STBR.alertamount = "Discount should not be Greater than Total Amount";
}
else {
$scope.STBR.alertamount = null;
//$scope.submitted = true;
//$scope.isFormValid = false;
}
var totalamtafdis = $scope.STBR.TotalAmountafterDiscount;
if (parseInt(totalamtafdis) < 0) {
//alert("Total Amount should not be Less than or Equal to Zero");
$scope.STBR.alertTotalamount = "Total Amount should not be Less than Zero";
}
else {
$scope.STBR.alertTotalamount = null;
//$scope.submitted = true;
//$scope.isFormValid = false;
}
}
var stbamtt = stbamout;
if (stbamtt == null || stbamtt == undefined || stbamtt == "" || stbamtt == 0) {
stbamtt = "0";
}
var stbamout1 = stbamtt.replace(/[^0-9\.]+/g, "");
var t1 = routeramount;
if (t1 == null || t1 == undefined || t1 == "" || t1 == 0) {
t1 = "0";
}
var routeramount1 = t1.replace(/[^0-9\.]+/g, "");
var t2 = Instalamt;
if (t2 == null || t2 == undefined || t2 == "" || t2 == 0) {
t2 = "0";
}
var Instalamt1 = t2.replace(/[^0-9\.]+/g, "");
$scope.result = parseInt(stbamout1) + parseInt(routeramount1) + parseInt(Instalamt1);
var totalamtt = $scope.result;
$scope.STBR.TotalAmount = $scope.CurrencyFormat(totalamtt);
var t3 = DiscountAmt;
if (t3 == null || t3 == undefined || t3 == "" || t3 == 0) {
t3 = "0";
}
var DiscountAmt1 = t3.replace(/[^0-9\.]+/g, "");
$scope.Finalresult = $scope.result - parseInt(DiscountAmt1);
$scope.STBR.TotalAmountafterDiscount = $scope.CurrencyFormat($scope.Finalresult);
}
//****************** FUNCTION FOR CALCULATING TOTALS *******************************//
//****************** SAVING STB RTR DEATILS *******************************//
$scope.SaveSTBRTRDetails = function () {
;
try {
var checkScope = true;
var dstamt = $scope.STBR.DiscountAmount;
if (dstamt == null || dstamt == undefined || dstamt == "" || dstamt == 0) {
dstamt = "0";
}
dstamt = dstamt.replace(/[^0-9\.]+/g, "");
var totalamt = $scope.STBR.TotalAmount;
if (totalamt == null || totalamt == undefined || totalamt == "" || totalamt == 0) {
totalamt = "0";
}
totalamt = totalamt.replace(/[^0-9\.]+/g, "");
if (parseInt(dstamt) > 0 || parseInt(totalamt) > 0) {
if (parseInt(dstamt) > parseInt(totalamt)) {
//alert("Discount should not be Greater than or Equal to Total Amount");
$scope.STBR.alertamount = "Discount should not be Greater than Total Amount";
//$scope.isFormValid = false;
checkScope = false;
}
var totalamtaftrdis = $scope.STBR.TotalAmountafterDiscount;
if (totalamtaftrdis == null || totalamtaftrdis == undefined || totalamtaftrdis == "" || totalamtaftrdis == 0) {
totalamtaftrdis = "0";
}
totalamtaftrdis = totalamtaftrdis.replace(/[^0-9\.]+/g,"");
if (parseInt(totalamtaftrdis) < 0) {
//alert("Total Amount should not be Less than or Equal to Zero");
$scope.STBR.alertTotalamount = "Total Amount should not be Less than Zero";
//$scope.isFormValid = false;
checkScope = false;
}
}
var Type = $scope.STBR.vchSTBType;
var stbno = $scope.STBR.stbserialnumber;
var url = baseurl + "/CableTransactions/checkSerialNumbers";// routerserialnumber: $scope.STBR.routerserialnumber, obj: $scope.STBR.vchRouterType, PackageTypeId: Type, Stbno: stbno
$http.post(url, { routerserialnumber: $scope.STBR.routerserialnumber, obj: $scope.STBR.vchRouterType, PackageTypeId: Type, Stbno: stbno }).success(function (data) {
;
if (data > 0) {
alert("Serial number Already Existed");
checkScope = false;
$scope.STBR.routerserialnumber = '';
}
else {
$scope.CalculateData();
$scope.submitted = true;
console.log($scope.subscriberSTBRdetails.$error.required);
if ($scope.isFormValid && checkScope) {
var ans = null;
var ans = confirm($rootScope.msgSave);
if (ans) {
;
var t1 = $scope.STBR.AdvanceAmount;
if (t1 == null || t1 == undefined || t1 == "" || t1 == 0) {
t1 = "0";
}
var t2 = $scope.STBR.DiscountAmount;
if (t2 == null || t2 == undefined || t2 == "" || t2 == 0) {
t2 = "0";
}
var t3 = $scope.STBR.InstallationCharges;
t3 += '';
if (t3 == null || t3 == undefined || t3 == "" || t3 == 0) {
t3 = "0";
}
var t4 = $scope.STBR.TotalAmount;
if (t4 == null || t4 == undefined || t4 == "" || t4 == 0) {
t4 = "0";
}
var t5 = $scope.STBR.TotalAmountafterDiscount;
if (t5 == null || t5 == undefined || t5 == "" || t5 == 0) {
t5 = "0";
}
var t6 = $scope.STBR.rtramount;
if (t6 == null || t6 == undefined || t6 == "" || t6 == 0) {
t6 = "0";
}
var t7 = $scope.STBR.stbamount;
if (t7 == null || t7 == undefined || t7 == "" || t7 == 0) {
t7 = "0";
}
$scope.STBR.AdvanceAmount = t1.replace(/[^0-9\.]+/g, "");
$scope.STBR.DiscountAmount = t2.replace(/[^0-9\.]+/g, "");
$scope.STBR.InstallationCharges = t3.replace(/[^0-9\.]+/g, "");
$scope.STBR.TotalAmount = t4.replace(/[^0-9\.]+/g, "");
$scope.STBR.TotalAmountafterDiscount = t5.replace(/[^0-9\.]+/g, "");
$scope.STBR.rtramount = t6.replace(/[^0-9\.]+/g, "");
$scope.STBR.stbamount = t7.replace(/[^0-9\.]+/g, "");
;
//var contype = $.grep($scope.lstconntype, function (c) {
// return c.ddlconnTypeid = $scope.STBR.ddlconnTypeid;
//})[0].ddlconnType;
//$scope.STBR.ddlconnType = contype;
var url = baseurl + "/CableTransactions/SaveSubscriberSTBRTRDetails";
$http.post(url, { jsonData: JSON.stringify($scope.STBR) }).success(function (data) {
;
alert(data.Message);
if (data.transstatus) {
$scope.ResetSubscriberSTBRTRDetails();
$scope.LoadSubscirberData();
$scope.GetGridData();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
$scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.GetSubscriberInformationAllDetails();
}
});
}
}
//else {
// alert("Please Fill all the Details");
//}
}
});
;
;
// $scope.CalculateData();
//$scope.submitted = true;
//if ($scope.isFormValid && checkScope)
//{
// var ans = null;
// var ans = confirm($rootScope.msgSave);
// if (ans) {
// $http.post('/CableTransactions/SaveSubscriberSTBRTRDetails', { objSubscriberSetupBoxRouterDetails: $scope.STBR }).success(function (data)
// {
// ;
// alert(data.Message);
// if (data.transstatus) {
// $scope.ResetSubscriberSTBRTRDetails();
// $scope.LoadSubscirberData();
// $scope.GetGridData();
// $scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// $scope.STBR.installationdate = $filter('date')(new Date(), 'dd/MM/yyyy');
// // $scope.GetSubscriberInformationAllDetails();
// }
// });
// }
//}
//else {
// alert("Please Fill all the Details");
//}
}
catch (e) {
alert(e.message);
}
}
$scope.ResetSubscriberSTBRTRDetails = function () {
;
try {
$scope.ClearSubscriberSTBRTRDetails();
$scope.STBR.datdate = $filter('date')(new Date(), 'dd/MM/yyyy');
} catch (e) {
alert(e.message);
}
}
//****************** SAVING STB RTR DEATILS *******************************//
//****************** JQ Grid *******************************//
$scope.GetGridData = function () {
;
var url = baseurl + "/CableTransactions/GetSubscriberSTBRTRAllDetails";
$http({
url: url,
method: "get"
}).success(function (data) {
;
ShowSubscriberSTBRTRDetails(data);
//console.log(data);
});
}
function ShowSubscriberSTBRTRDetails(data) {
;
for (i = 0; i < data.length; i++) {
var Amount1 = data[i].rtramount;
var Amount2 = $scope.CurrencyFormat(Amount1);
data[i].rtramount = [];
data[i].rtramount = Amount2;
var Amount11 = data[i].stbamount;
var Amount22 = $scope.CurrencyFormat(Amount11);
data[i].stbamount = [];
data[i].stbamount = Amount22;
var Amount111 = data[i].Discountamount;
var Amount222 = $scope.CurrencyFormat(Amount111);
data[i].Discountamount = [];
data[i].Discountamount = Amount222;
var t1 = data[i].numtotalamount;
var t2 = $scope.CurrencyFormat(t1);
data[i].numtotalamount = [];
data[i].numtotalamount = t2;
var t11 = data[i].Advanceamount;
var t22 = $scope.CurrencyFormat(t11);
data[i].Advanceamount = [];
data[i].Advanceamount = t22;
var t12 = data[i].InstallationCharges;
var t21 = $scope.CurrencyFormat(t12);
data[i].InstallationCharges = [];
data[i].InstallationCharges = t21;
}
var grid_data = data;
var grid_selector = "#gridsubscriberSTBRTRdetails";
var pager_selector = "#grid-pager";
//grid data refresh
jQuery(grid_selector).jqGrid('setGridParam', { datatype: 'local', data: grid_data }).trigger("reloadGrid");
//resize to fit page size
$(window).on('resize.jqGrid', function () {
$(grid_selector).jqGrid('setGridWidth', $(".page-content").width());
})
//resize on sidebar collapse/expand
var parent_column = $(grid_selector).closest('[class*="col-"]');
$(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
//setTimeout is for webkit only to give time for DOM changes and then redraw!!!
setTimeout(function () {
$(grid_selector).jqGrid('setGridWidth', parent_column.width());
}, 0);
}
})
jQuery(grid_selector).jqGrid({
data: grid_data,
datatype: "local",
height: 290,
rownumbers: true,
colModel: [
{ label: 'Connection <br/><br/><br/><br/>ID', name: 'connectionid', width: 55, },
{ label: 'Subscriber <br/><br/><br/><br/>Name', name: 'suscribername', width: 80, },
{ label: 'Mobile <br/><br/><br/><br/>Number', name: 'mobilenumber', width: 65 },
{ label: 'Package <br/><br/><br/><br/>Type', name: 'packagetype', width: 45, },
{ label: 'Connection <br/><br/><br/><br/>Type', name: 'connectiontype', width: 55, },
{ label: 'Router <br/><br/><br/><br/>Sr No.', name: 'routerserialnumber', width: 40 },
{ label: 'Router <br/><br/><br/><br/>Amount', name: 'rtramount', width: 45, align: 'right' },
{ label: 'Router Warranty', name: 'rtrwarranty', width: 50, hidden: true },
{ label: 'STB <br/><br/><br/><br/>Sr No.', name: 'stbserialnumber', width: 50 },
{ label: 'STB <br/><br/><br/><br/>Amount', name: 'stbamount', width: 45, align: 'right' },
{ label: 'STB Warranty', name: 'stbwarranty', width: 50, hidden: true },
{ label: 'Installation <br/><br/><br/><br/>Charges', name: 'InstallationCharges', width: 60, align: 'right' },
{ label: 'Installed <br/><br/><br/><br/>By', name: 'employeename', width: 50, hidden: true },
{ label: 'Installation <br/><br/><br/><br/>Date', name: 'installationdate', width: 65, },
{ label: 'Discount <br/><br/><br/><br/>Amount', name: 'Discountamount', width: 50, align: 'right' },
{ label: 'Total <br/><br/><br/><br/>Amount', name: 'numtotalamount', width: 45, align: 'right', hidden: true },
{ label: 'Total <br/><br/><br/><br/>Amount ', name: 'numtotalamount', width: 45, align: 'right' },
{ label: 'STB Type', name: 'stbtype', width: 50, hidden: true },
{ label: 'Router Type', name: 'rtbtype', width: 50, hidden: true },
{ label: 'Advance Amount', name: 'Advanceamount', width: 50, hidden: true },
{
label: ' ', width: 55, sortable: false, key: true, formatter: function (cellvalue, options, rowObject) {
return "<button class='btn-grid' type='button' id='btnEdit' onclick='ViewRow(" + options.rowId + ");'><i class='fa fa-eye'></i><span style='color:#111;font-size:14px;font-weight:400'> View</span><br/></button> ";
}
}
],
viewrecords: true,
rowNum: 8,
rowList: [8, 16, 25, 100],
pager: pager_selector,
altRows: true,
search: true,
ignoreCase: true,
loadComplete: function (id) {
var table = this;
setTimeout(function () {
styleCheckbox(table);
updateActionIcons(table);
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
caption: "Subscriber Set Up Box and Router Details <span class='input-icon grid-search'> <input type='text' onkeyup='Search()' id='globalSearchText' placeholder='Search ...' class='nav-search-input' autocomplete='off'> <i class='ace-icon fa fa-search nav-search-icon'></i></span> "
});
$(window).triggerHandler('resize.jqGrid');
}
$scope.InstallaCharges = function (data) {
;
//var InstallCharg = $scope.STBR.InstallationCharges;
if (data == null || data == "" || data == 0 || data == undefined) {
$scope.STBR.InstallationCharges = 0;
}
//var InstallCharg = $scope.STBR.InstallationCharges;
//if(InstallCharg==0 || InstallCharg==null ||InstallCharg==undefined)
//{
// $scope.STBR.InstallationCharges = 0;
//}
}
$scope.Desposeamt = function () {
;
var desposeamtt = $scope.STBR.AdvanceAmount;
if (desposeamtt == 0 || desposeamtt == "" || desposeamtt == null || desposeamtt == undefined) {
$scope.STBR.AdvanceAmount = 0;
}
}
$scope.discountamt = function () {
;
var discountamtt = $scope.STBR.DiscountAmount;
if (discountamtt == 0 || discountamtt == "" || discountamtt == null || discountamtt == undefined) {
$scope.STBR.DiscountAmount = 0;
}
}
$scope.totalamt = function () {
;
var totalamtt = $scope.STBR.TotalAmount;
if (totalamtt == 0 || totalamtt == "" || totalamtt == null || totalamtt == undefined) {
$scope.STBR.TotalAmount = 0;
}
}
$scope.totalamtaftrdst = function () {
;
var totalamtaftrdstt = $scope.STBR.TotalAmountafterDiscount;
if (totalamtaftrdstt == 0 || totalamtaftrdstt == "" || totalamtaftrdstt == null || totalamtaftrdstt == undefined) {
$scope.STBR.TotalAmountafterDiscount = 0;
}
}
$scope.CurrencyFormat = function (nStr) {
;
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
var z = 0;
var len = String(x1).length;
var num = parseInt((len / 2) - 1);
while (rgx.test(x1)) {
if (z > 0) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
else {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
rgx = /(\d+)(\d{2})/;
}
z++;
num--;
if (num == 0) {
break;
}
}
return x1 + x2;
}
$scope.SetCurrency = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.InstallationCharges = $scope.CurrencyFormat(amount);
}
$scope.SetCurrencyDiscount = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.DiscountAmount = $scope.CurrencyFormat(amount);
}
$scope.SetCurrencyAdvance = function (instalamt) {
;
var amount = 0;
var amtt = instalamt;
if (amtt == null || amtt == undefined || amtt == "" || amtt == 0) {
amtt = "0";
}
amount = amtt.replace(/[^0-9\.]+/g, "");
$scope.STBR.AdvanceAmount = $scope.CurrencyFormat(amount);
}
//****************** JQ Grid *******************************//
});
No comments:
Post a Comment