<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Dear Irina,</p>
    <p>Thank you for having a look at this. I used the script as
      specified in the cron job
      (/usr/share/ngcp-panel/tools/generate_invoices.pl) to try to
      generate some debugging info, without much success. That's the
      reason I analyzed this further with the SQL debug log. But I think
      the web interface produces the same results. I temporary solved
      the issue by setting the startdate to NULL.</p>
    <p>Best regards,</p>
    <p>Henk Plessius  <br>
    </p>
    <br>
    On 18-1-2017 17:25, Irina Peshinskaya wrote:<br>
    <blockquote
      cite="mid:9245581a-81e9-8425-65b1-78a11fa81886@sipwise.com"
      type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <p>Dear Henk,<br>
      </p>
      Could you please describe what do you mean by "manually" generated
      invoices? <br>
      Did you use WEB interface for this? <br>
      <br>
      Thanks in advance.<br>
      <br>
      Best regards,<br>
      Irina Peshinskaya<br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 15.01.2017 19:56, Henk wrote:<br>
      </div>
      <blockquote
        cite="mid:08108fa6-4ade-8db9-5e27-760fe4f6d6c0@voipdigit.nl"
        type="cite">
        <meta content="text/html; charset=utf-8"
          http-equiv="Content-Type">
        <p>Sorry, that format wasn't working. I hope this will be more
          readable<br>
        </p>
        I'm on mr5.0.1.1 and have the wrong billing profile on my
        (manually) generated invoices from january.<br>
        After some research I found the date selection on
        billing_mappings isn't working. The start_date is 10-1-2017.
        Only the records with start_date NULL are selected.<br>
        <br>
        From the sql query log:<br>
        <br>
        select * FROM billing_mappings <br>
                where contract_id = '17' <br>
                    and (billing_mappings.start_date <= '1485903599'
        OR billing_mappings.start_date is null)<br>
                    and (billing_mappings.end_date >= '1483225200' OR
        billing_mappings.end_date is null)<br>
                order by billing_mappings.start_date desc,
        billing_mappings.id desc limit 1<br>
        <br>
        If I add from_unixtime it's working and I get the right one:<br>
        <br>
        select * FROM billing_mappings <br>
                where contract_id = '17' <br>
                    and (billing_mappings.start_date <= <code
          class="sql">from_unixtime(</code>'1485903599') OR
        billing_mappings.start_date is null)<br>
                    and (billing_mappings.end_date >= <code
          class="sql">from_unixtime(</code>'1483225200') OR
        billing_mappings.end_date is null)<br>
                order by billing_mappings.start_date desc,
        billing_mappings.id desc limit 1<br>
        <br>
        Maybe this is related to MariaDB?<br>
        <br>
        Regards,<br>
        <br>
        Henk Plessius<br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Spce-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a>
</pre>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>