<commit_before>angular.module('app.services')

.service('BillService', [function(){
  var bill = {
    totalAmount: undefined,
    vat: 7,
    vatAmount: 0,
    serviceCharge: 10,
    serviceChargeAmount: 0
  };

  return {

    setBill: function(bill) {
      bill = bill;
    },

    getBill: function() {
      return bill;
    },

    calculateGrandTotal: function(){
      if(bill.totalAmount) {
        bill.vatAmount = (bill.totalAmount * (bill.vat/100)).toFixed(2);
        var afterVat = Number(bill.totalAmount) + Number(bill.vatAmount);

        bill.serviceChargeAmount = (afterVat * (bill.serviceCharge/100)).toFixed(2);
        var afterServiceCharge = Number(afterVat) + Number(bill.serviceChargeAmount);

        bill.grandTotal = afterServiceCharge;
      } else {
        bill.vatAmount = 0;
        bill.serviceChargeAmount = 0;
        bill.grandTotal = 0;
      }
      return bill;
    }

  };
}]);
<commit_msg>Create reset bill function<commit_after>angular.module('app.services')

.service('BillService', [function(){
  var bill = {
    totalAmount: undefined,
    vat: 7,
    vatAmount: 0,
    serviceCharge: 10,
    serviceChargeAmount: 0
  };

  return {

    setBill: function(bill) {
      bill = bill;
    },

    getBill: function() {
      return bill;
    },

    calculateGrandTotal: function(){
      if(bill.totalAmount) {
        bill.vatAmount = (bill.totalAmount * (bill.vat/100)).toFixed(2);
        var afterVat = Number(bill.totalAmount) + Number(bill.vatAmount);

        bill.serviceChargeAmount = (afterVat * (bill.serviceCharge/100)).toFixed(2);
        var afterServiceCharge = Number(afterVat) + Number(bill.serviceChargeAmount);

        bill.grandTotal = afterServiceCharge;
      } else {
        bill.vatAmount = 0;
        bill.serviceChargeAmount = 0;
        bill.grandTotal = 0;
      }
      return bill;
    },

    resetBill: function(){
      bill = {
        totalAmount: undefined,
        vat: 7,
        vatAmount: 0,
        serviceCharge: 10,
        serviceChargeAmount: 0
      };
    }

  };
}]);

{'fraction_non_alphanumeric': 0.12729912875121008, 'fraction_numerical': 0.017909002904162634, 'mean_word_length': 2.4335548172757475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2989830', 'n_tokens_mistral': 718, 'n_tokens_neox': 643, 'n_words': 120}