diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index d3cf0ae7..18b7cdc4 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -2626,528 +2626,132 @@ function addNewImportPurchaseOrder() /*This function is used to convert amount(digit) into words*/ - public function convertNumber($number) + public function convertNumber($amt){ -{ - - list($integer, $fraction) = explode(".", (string) $number); - - $output = "Rupee"." "; - - if ($integer{0} == "-") - - { - - $output = "negative "; - - $integer = ltrim($integer, "-"); - - } - - else if ($integer{0} == "+") - - { - - $output = "positive "; - - $integer = ltrim($integer, "+"); - - } - - if ($integer{0} == "0") - - { - - $output .= "zero"; - - } - - else - - { - - $integer = str_pad($integer, 36, "0", STR_PAD_LEFT); - - $group = rtrim(chunk_split($integer, 3, " "), " "); - - $groups = explode(" ", $group); - - $groups2 = array(); - - foreach ($groups as $g) - - { - - $groups2[] = $this->convertThreeDigit($g{0}, $g{1}, $g{2}); - - } - - for ($z = 0; $z < count($groups2); $z++) - - { - - if ($groups2[$z] != "") - - { - - $output .= $groups2[$z] . $this->convertGroup(11 - $z) . ( - - $z < 11 - - && !array_search('', array_slice($groups2, $z + 1, -1)) - - && $groups2[11] != '' - - && $groups[11]{0} == '0' - - ? " " - - : ", " - - ); - - } - - } - - $output = rtrim($output, ", "); - - } - - if ($fraction > 0) - - { - - $output .= " paise"; - - for ($i = 0; $i < strlen($fraction); $i++) - - { - - $output .= " " . $this->convertDigit($fraction{$i}); - - } - - } - - return $output; +$totalAmt=explode(".",$amt); +$number = $totalAmt[0]; + $no = $number; +if(!empty($totalAmt[1])){ +$point = $totalAmt[1]; } - /* get symbol based amount in words*/ - - - public function convertNumberSymbol($number,$symbol,$name,$paise) - -{ - - list($integer, $fraction) = explode(".", (string) $number); - - $output = $name." "; - - if ($integer{0} == "-") - - { - - $output = "negative "; - - $integer = ltrim($integer, "-"); - - } - - else if ($integer{0} == "+") - - { - - $output = "positive "; - - $integer = ltrim($integer, "+"); - - } - - if ($integer{0} == "0") - - { - - $output .= "zero"; - - } - - else - - { - - $integer = str_pad($integer, 36, "0", STR_PAD_LEFT); - - $group = rtrim(chunk_split($integer, 3, " "), " "); - - $groups = explode(" ", $group); - - $groups2 = array(); - - foreach ($groups as $g) - - { - - $groups2[] = $this->convertThreeDigit($g{0}, $g{1}, $g{2}); - - } - - for ($z = 0; $z < count($groups2); $z++) - - { - - if ($groups2[$z] != "") - - { - - $output .= $groups2[$z] . $this->convertGroup(11 - $z) . ( - - $z < 11 - - && !array_search('', array_slice($groups2, $z + 1, -1)) - - && $groups2[11] != '' - - && $groups[11]{0} == '0' - - ? " " - - : ", " - - ); - - } - - } - - $output = rtrim($output, ", "); - - } - - if ($fraction > 0) - - { - - $output .= $paise; - - for ($i = 0; $i < strlen($fraction); $i++) - - { - - $output .= " " . $this->convertDigit($fraction{$i}); - - } - - } - - return $output; - -} -public function convertGroup($index) - -{ - - switch ($index) - - { - - case 11: - - return " decillion"; - - case 10: - - return " nonillion"; - - case 9: - - return " octillion"; - - case 8: - - return " septillion"; - - case 7: - - return " sextillion"; - - case 6: - - return " quintrillion"; - - case 5: - - return " quadrillion"; - - case 4: - - return " trillion"; - - case 3: - - return " billion"; - - case 2: - - return " million"; - - case 1: - - return " thousand"; - - case 0: - - return ""; - - } - + else{ +$point=0; } -public function convertThreeDigit($digit1, $digit2, $digit3) -{ + $hundred = null; + $digits_1 = strlen($no); - $buffer = ""; + $i = 0; + $str = array(); + $words = array('0' => '', '1' => 'one', '2' => 'two', + '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six', + '7' => 'seven', '8' => 'eight', '9' => 'nine', + '10' => 'ten', '11' => 'eleven', '12' => 'twelve', + '13' => 'thirteen', '14' => 'fourteen', + '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', + '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty', + '30' => 'thirty', '40' => 'forty', '50' => 'fifty', + '60' => 'sixty', '70' => 'seventy', + '80' => 'eighty', '90' => 'ninety'); + $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); + while ($i < $digits_1) { + $divider = ($i == 2) ? 10 : 100; + $number = floor($no % $divider); + $no = floor($no / $divider); + $i += ($divider == 10) ? 1 : 2; + if ($number) { + $plural = (($counter = count($str)) && $number > 9) ? 's' : null; + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; + $str [] = ($number < 21) ? $words[$number] . + " " . $digits[$counter] . $plural . " " . $hundred + : + $words[floor($number / 10) * 10] + . " " . $words[$number % 10] . " " + . $digits[$counter] . $plural . " " . $hundred; + } else $str[] = null; + } + $str = array_reverse($str); + $result = implode('', $str); - if ($digit1 == "0" && $digit2 == "0" && $digit3 == "0") + $points = ($point) ? + " " . $words[$point / 10] . " " . + $words[$point = $point % 10] : ''; - { +if(($point=='' || $point=='00' || $point=='0') && $points==''){ +$amountInWords = "Rupee " . $result." Only"; +} +else{ - return ""; +$amountInWords = "Rupee " . $result ." Paise ". $points." Only"; +} + - } + return $amountInWords; + } +public function convertNumberSymbol($amt,$symbol,$name,$paise){ - if ($digit1 != "0") - - { - - $buffer .= $this->convertDigit($digit1) . " hundred"; - - if ($digit2 != "0" || $digit3 != "0") - - { - - $buffer .= " and "; - - } - - } - - if ($digit2 != "0") - - { - - $buffer .= $this->convertTwoDigit($digit2, $digit3); - - } - - else if ($digit3 != "0") - - { - - $buffer .= $this->convertDigit($digit3); - - } - - return $buffer; +$totalAmt=explode(".",$amt); +$number = $totalAmt[0]; + $no = $number; +if(!empty($totalAmt[1])){ +$point = $totalAmt[1]; +} + else{ +$point=0; } -public function convertTwoDigit($digit1, $digit2) - -{ - - if ($digit2 == "0") - - { - - switch ($digit1) - - { - - case "1": - - return "ten"; - - case "2": - - return "twenty"; - - case "3": - - return "thirty"; - - case "4": - - return "forty"; - - case "5": - - return "fifty"; - - case "6": - - return "sixty"; - - case "7": - - return "seventy"; - - case "8": - - return "eighty"; - - case "9": - - return "ninety"; - - } - - } else if ($digit1 == "1") - - { - - switch ($digit2) - - { - - case "1": - - return "eleven"; - - case "2": - - return "twelve"; - - case "3": - - return "thirteen"; - - case "4": - - return "fourteen"; - - case "5": - - return "fifteen"; - - case "6": - - return "sixteen"; - - case "7": - - return "seventeen"; - - case "8": - - return "eighteen"; - - case "9": - - return "nineteen"; - - } - - } else - - { - - $temp = $this->convertDigit($digit2); - - switch ($digit1) - - { - - case "2": - - return "twenty-$temp"; - - case "3": - - return "thirty-$temp"; - - case "4": - - return "forty-$temp"; - - case "5": - - return "fifty-$temp"; - - case "6": - - return "sixty-$temp"; - - case "7": - - return "seventy-$temp"; - - case "8": - - return "eighty-$temp"; - - case "9": - - return "ninety-$temp"; - - } - - } - + $hundred = null; + $digits_1 = strlen($no); + + $i = 0; + $str = array(); + $words = array('0' => '', '1' => 'one', '2' => 'two', + '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six', + '7' => 'seven', '8' => 'eight', '9' => 'nine', + '10' => 'ten', '11' => 'eleven', '12' => 'twelve', + '13' => 'thirteen', '14' => 'fourteen', + '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', + '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty', + '30' => 'thirty', '40' => 'forty', '50' => 'fifty', + '60' => 'sixty', '70' => 'seventy', + '80' => 'eighty', '90' => 'ninety'); + $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); + while ($i < $digits_1) { + $divider = ($i == 2) ? 10 : 100; + $number = floor($no % $divider); + $no = floor($no / $divider); + $i += ($divider == 10) ? 1 : 2; + if ($number) { + $plural = (($counter = count($str)) && $number > 9) ? 's' : null; + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; + $str [] = ($number < 21) ? $words[$number] . + " " . $digits[$counter] . $plural . " " . $hundred + : + $words[floor($number / 10) * 10] + . " " . $words[$number % 10] . " " + . $digits[$counter] . $plural . " " . $hundred; + } else $str[] = null; + } + $str = array_reverse($str); + $result = implode('', $str); + + $points = ($point) ? + " " . $words[$point / 10] . " " . + $words[$point = $point % 10] : ''; + +if(($point=='' || $point=='00' || $point=='0') && $points==''){ +$amountInWords = $name." " . $result." Only"; } - -public function convertDigit($digit) - -{ - - switch ($digit) - - { - - case "0": - - return "zero"; - - case "1": - - return "one"; - - case "2": - - return "two"; - - case "3": - - return "three"; - - case "4": - - return "four"; - - case "5": - - return "five"; - - case "6": - - return "six"; - - case "7": - - return "seven"; - - case "8": - - return "eight"; - - case "9": - - return "nine"; - - } - +else{ +$amountInWords = $name." " . $result.$paise ." ". $points." Only"; } + + + return $amountInWords; + } diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 2cd2d63c..884d74f2 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -609,7 +609,7 @@ function purchaseorderListing($forwhat='') $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.ServiceMaterialDescription,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Mat.HSNCODE, LineItem.Quantity,LineItem.Rate,(LineItem.Quantity *LineItem.Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount - ,TotalValue,CGST,SGST,IGST,After_CGST,After_SGST,After_IGST,otherallowance,LineItem.CostCenterCode,sup.SupplierName,sup.Address,POMaster.DeliveryAddress,POMaster.DeliveryDate,POMaster.Status,POMaster.PODate,POMaster.PONO,POMaster.ServiceDescription,POMaster.PaymentOtherDescription,ReqMat.NumberOfService,ReqMat.Service_Period,ReqMat.Schedule_Type,Payment.PaymentID,Payment.PaymentTerms,AdvanceAmount FROM + ,TotalValue,CGST,SGST,IGST,After_CGST,After_SGST,After_IGST,otherallowance,LineItem.CostCenterCode,sup.SupplierName,sup.Address,POMaster.DeliveryAddress,POMaster.DeliveryDate,POMaster.Status,POMaster.PODate,POMaster.PONO,POMaster.ServiceDescription,POMaster.PaymentOtherDescription,POMaster.DeliveryOption,POMaster.DeliverySchedule,ReqMat.NumberOfService,ReqMat.Service_Period,ReqMat.Schedule_Type,Payment.PaymentID,Payment.PaymentTerms,AdvanceAmount FROM T_PurchaseOrder_LineItem LineItem join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index a8c6cc9f..e073f411 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -1295,7 +1295,7 @@ $(document).ready(function () { 'EdittxtSpcialInstruction','value' => set_value('EdittxtSpcialInstruction',$ServiceDescription),'id'=>'EdittxtSpcialInstruction', 'class' => 'form-control'); echo form_input($data); - ?> + ?> diff --git a/application/views/alterpurchaseorder.php b/application/views/alterpurchaseorder.php index 03abe5af..f7c63984 100755 --- a/application/views/alterpurchaseorder.php +++ b/application/views/alterpurchaseorder.php @@ -4836,7 +4836,7 @@ function populateValueMainFormForDeleteItem(rowid)
'txtSpcialInstruction','value' => set_value('txtSpcialInstruction'),'id'=>'txtSpcialInstruction', 'class' => 'form-control'); + $data = array('name' => 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction'),'id'=>'txtSpcialInstruction', 'class' => 'form-control','rows' => '8'); echo form_textarea($data); ?>
@@ -4919,7 +4919,7 @@ function populateValueMainFormForDeleteItem(rowid)
'ScopeOfWork','value' => set_value('ScopeOfWork'),'id'=>'ScopeOfWork', 'class' => 'form-control num'); + $data = array('name' => 'ScopeOfWork','value' => set_value('ScopeOfWork'),'id'=>'ScopeOfWork', 'class' => 'form-control','rows' => '8'); echo form_textarea($data); ?>
diff --git a/application/views/capitalpopdf.php b/application/views/capitalpopdf.php index ca41f382..fb489ff7 100644 --- a/application/views/capitalpopdf.php +++ b/application/views/capitalpopdf.php @@ -271,7 +271,7 @@ - + diff --git a/application/views/editImportAmendPO.php b/application/views/editImportAmendPO.php index 7c3aaa92..89b3c1de 100755 --- a/application/views/editImportAmendPO.php +++ b/application/views/editImportAmendPO.php @@ -177,12 +177,8 @@ if(!empty($RequistionDetails)) padding-bottom: 0px; } - -.content { - Padding:0% ! important; -} -body { - background-color: #ecf0f5; + .num { + text-align:right; } .pagination { margin :0px ! important; @@ -211,14 +207,10 @@ body { - + \ No newline at end of file diff --git a/application/views/editRevenuepurchaseorder.php b/application/views/editRevenuepurchaseorder.php index 4a30c43d..a90157a8 100755 --- a/application/views/editRevenuepurchaseorder.php +++ b/application/views/editRevenuepurchaseorder.php @@ -1,4 +1,3 @@ - Quantity
'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change()'); + $data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();'); echo form_input($data); ?>
@@ -2366,7 +2363,7 @@ function calculateEditTaxValue()
'Rate','value' => set_value('Rate'),'id'=>'Rate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change()' ); + $data = array('name' => 'Rate','value' => set_value('Rate'),'id'=>'Rate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();' ); echo form_input($data); ?>
@@ -2430,7 +2427,7 @@ function calculateEditTaxValue()
'Cgst','value' => set_value('Cgst',0),'id'=>'Cgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();'); + $data = array('name' => 'Cgst','value' => set_value('Cgst',0),'id'=>'Cgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'change();'); echo form_input($data); ?>
@@ -2493,7 +2490,7 @@ function calculateEditTaxValue()
'Sgst','value' => set_value('Sgst',0),'id'=>'Sgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change()'); + $data = array('name' => 'Sgst','value' => set_value('Sgst',0),'id'=>'Sgst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change();'); echo form_input($data); ?>
@@ -2513,7 +2510,7 @@ function calculateEditTaxValue()
'Igst','value' => set_value('Igst',0),'id'=>'Igst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'change()'); + $data = array('name' => 'Igst','value' => set_value('Igst',0),'id'=>'Igst', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'change();'); echo form_input($data); ?>
@@ -2715,7 +2712,7 @@ function calculateEditTaxValue()
'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange()','style'=>'text-align:right;'); + $data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;'); echo form_input($data); ?>
@@ -2724,7 +2721,7 @@ function calculateEditTaxValue()
'EditRate','value' => set_value('EditRate'),'id'=>'EditRate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange()','style'=>'text-align:right;' ); + $data = array('name' => 'EditRate','value' => set_value('EditRate'),'id'=>'EditRate', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Editchange();','style'=>'text-align:right;' ); echo form_input($data); ?>
@@ -4153,7 +4150,7 @@ function validateEditRevenueTax() function calculateCgstTax(varBasicValue,Cgst,discount) { var discount = discount; - var basicValue = parseFloat(varBasicValue); + var basicValue = parseFloat(varBasicValue-discount); var Cgst = parseFloat(Cgst); var ServiceTaxValue = 0.0; @@ -4167,7 +4164,7 @@ function calculateCgstTax(varBasicValue,Cgst,discount) function calculateSgstTax(varBasicValue,Sgst,discount) { var discount = discount; - var basicValue = parseFloat(varBasicValue); + var basicValue = parseFloat(varBasicValue-discount); var Sgst = parseFloat(Sgst); var ServiceTaxValue = 0.0; @@ -4181,7 +4178,7 @@ function calculateCgstTax(varBasicValue,Cgst,discount) function calculateIgstTax(varBasicValue,Igst,discount) { var discount = discount; - var basicValue = parseFloat(varBasicValue); + var basicValue = parseFloat(varBasicValue-discount); var Igst = parseFloat(Igst); var ServiceTaxValue = 0.0; @@ -4512,7 +4509,7 @@ function change(){ if($("#Igst").val()!=''){ - $('#AfterIgst').val(calculateIgstTax($('#txtBasicValue').val(),$('#Igst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val()); + $('#AfterIgst').val(calculateIgstTax($('#txtBasicValue').val(),$('#Igst').val(),$('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val())); } diff --git a/application/views/purchaseorder.php b/application/views/purchaseorder.php index c444e0db..3dcaa5ef 100755 --- a/application/views/purchaseorder.php +++ b/application/views/purchaseorder.php @@ -3997,4 +3997,4 @@ $("#PaymentTerms").change(function() { - + \ No newline at end of file diff --git a/application/views/servicepopdf.php b/application/views/servicepopdf.php index 6f762360..985f59fc 100755 --- a/application/views/servicepopdf.php +++ b/application/views/servicepopdf.php @@ -65,7 +65,15 @@ $dt = new DateTime($PO->PODate, new DateTimeZone('Asia/Kolkata')); $Podt = $dt->format('d-m-Y'); $dtDe = new DateTime($PO->DeliveryDate, new DateTimeZone('Asia/Kolkata')); + if($PO->DeliveryOption=='1'){ + $DeliveryDate = ''; + $DeliverySchedule = $PO->DeliverySchedule; + } + else{ + $dtDe = new DateTime($PO->DeliveryDate, new DateTimeZone('Asia/Kolkata')); $DeliveryDate = $dtDe->format('d-m-Y'); + $DeliverySchedule = ''; + } $ServiceDescription =$PO->ServiceDescription; if($PO->PaymentID!='PT08'){ $PaymentTerms = $PO->PaymentTerms;
Total Amount In Words

Total Amount In Words

Total Order Amount in Total Order Amount in